C-CDA to FHIR System API - Implementation Template
Developer guide
This document provides information generated from the DataWeave scripts included in the project, such as function definitions, variable definitions, and data mapping tables. It can be used by developers seeking a solution to convert C-CDA XML-based objects to FHIR R4 JSON.
C-CDA Document List
The table provided below includes the C-CDA document type (eg. Continuity of Care or CCD) and the corresponding CDA sections that can be reused across various FHIR conversion requirements.
| Document | Description |
|---|---|
| Continuity Of Care | The Continuity of Care Document (CCD) represents a core data set of the most relevant administrative, demographic, and clinical information facts about a patient's healthcare, covering one or more healthcare encounters. Supported Sections: Allergies and Intolerances, Medications, Problem, Procedures, Results, Advanced Directives, Encounters, Family History, Functional Status, Immunization, Medical Equipment, Payers, Plan of Treatment, Social History, Vital Signs, Mental Status, Nutrition |
| Discharge Summary | The Discharge Summary is a document which synopsizes a patient's admission to a hospital, LTPAC provider, or other setting. It provides information for the continuation of care following discharge. Supported Sections: Allergies and Intolerances, Discharge Diagnosis, Discharge Medications, Plan of Treatment, Nutrition, Family History, Functional Status, Admission Diagnosis, Admission Medications, Immunization, Problem, Procedures, Social History, Vital Signs |
| Consultation Note | The Consultation Note is generated by a request from a clinician for an opinion or advice from another clinician. Consultations may involve face-to-face time with the patient or may fall under the auspices of telemedicine visits. Supported Sections: Allergies and Intolerances, Problem, Family History, Immunization, Medications, Procedures, Results, Social History, Vital Signs, Functional Status, Medical Equipment, Advanced Directives, Mental Status, Nutrition, Plan of Treatment |
| History and Physical | A History and Physical (H&P) note is a medical report that documents the current and past conditions of the patient. It contains essential information that helps determine an individual's health status. Supported Sections: Allergies and Intolerances, Family History, Medications, Results, Social History, Vital Signs, Immunization, Problem, Procedures, Plan of Treatment, Advanced Directives |
| Operative Note | The Operative Note is a frequently used type of procedure note with specific requirements set forth by regulatory agencies. The Operative Note is created immediately following a surgical or other high-risk procedure. Supported Sections: Procedure Anesthesia, Complications, Procedure Findings, Preoperative Diagnosis, Postoperative Diagnosis, Plan of Treatment |
| Progress Note | Progress Note represents a patients clinical status during a hospitalization, outpatient visit, treatment with a LTPAC provider, or other healthcare encounter. It also defines as an ongoing record of a patient's illness and treatment. Supported Sections: Allergies and Intolerances, Medications, Problem, Results, Vital Signs, Nutrition, Plan of Treatment, Advanced Directives |
| Procedure Note | A Procedure Note encompasses many types of non-operative procedures including interventional cardiology, gastrointestinal endoscopy, osteopathic manipulation, and many other specialty fields. Procedure Notes are differentiated from Operative Notes because they do not involve incision or excision as the primary act. Supported Sections: Allergies and Intolerances, Family History, Medications, Procedures, Social History, Complications, Postprocedure Diagnosis, Procedure Indications, Procedure Findings, Procedure Anesthesia |
| Referral Note | A Referral Note communicates pertinent information from a provider who is requesting services of another provider of clinical or non-clinical services. The information in this document includes the reason for the referral and additional information that would augment decision making and care delivery. Supported Sections: Reason for Referral, Problem, Allergies and Intolerances, Medications, Family History, Immunization, Procedures, Results, Social History, Vital Signs, Functional Status, Medical Equipment, Advanced Directives, Mental Status, Nutrition |
| Transfer Summary | The Transfer Summary standardizes critical information for exchange of information between providers of care when a patient moves between health care settings. Supported Sections: Advanced Directives, Allergies and Intolerances, Encounters, Family History, Functional Status, Discharge Diagnosis, Immunization, Medical Equipment, Medications, Payers, Plan of Treatment, Problem, Procedures, Results, Social History, Vital Signs, Mental Status, Nutrition, Admission Diagnosis, Admission Medications, Reason for Referral |
| Unstructured Document | An Unstructured Document document type can (1) include unstructured content, such as a graphic, directly in a text element with a mediaType attribute, or (2) reference a single document file, such as a word-processing document using a text/reference element. Supported Sections: N/A |
convert-admissiondiagnosis-to-fhir
Converts Admission Diagnosis section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Condition
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convert-admissiondiagnosis-to-fhir.dwl
Functions
fun getCdaAdmissionDiagnosis (payload)
Gets a list of C-CDA admission diagnosis objects from the input payload.
param
payloadis the input XML CDA request.
return A list of C-CDA admission diagnosis objects or an empty list.
fun getCdaAdmissionDiagnosisEntries (cdaAdmissionDiagnosis)
Gets a filtered list of C-CDA admission diagnostic entries.
param
cdaAdmissionDiagnosisis a list of C-CDA entries.
return A filtered list of C-CDA admission diagnosis entries or an empty list.
fun buildAdmissionDiagnosisObservations (cdaAdmissionDiagnosisEntries, patientId, practitionersList)
Builds a list of admission diagnosis FHIR Observation objects.
param
cdaAdmissionDiagnosisEntriesis a filtered list of C-CDA admission diagnosis entries.
parampatientIdis a string with the patient ID.
parampractitionersListis a list of practitioners set as vars.practitionersList.
convert-admissionmedications-to-fhir
Converts Admission Medications section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Medication
MedicationRequest
MedicationDispense
MedicationStatement
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convert-admissionmedications-to-fhir.dwl
Functions
fun getCdaMedicationSections (payload)
Gets a list of C-CDA medication sections from the input payload.
param
payloadis the input XML CDA request.
return A list of C-CDA medication sections or an empty list.
fun buildMedication (cdaMedicationSections)
Builds a list of FHIR formatted Medication objects.
param
cdaMedicationSectionsis a list of C-CDA medication sections.
return A FHIR formatted list of Medication objects or an empty list.
fun buildMedicationRequest (cdaMedicationSections, patientId, practitionersList)
Builds a list of FHIR formatted MedicationRequest objects.
param
cdaMedicationSectionsis a list of C-CDA medication sections.
parampatientIdis a string with the patient ID.
parampractitionersListis a list of Practitioners set in the vars.practitionersList variable.
return A FHIR formatted list of MedicationRequest objects or an empty list.
fun buildMedicationDispence (cdaMedicationSections, patientId, medicationRequest, practitionersList)
Builds a list of FHIR formatted MedicationDispence objects.
param
cdaMedicationSectionsis a list of C-CDA medication sections.
parampatientIdis a string with the patient ID.
parammedicationRequestis a list of FHIR formatted MedicationRequest objects.
parampractitionersListis a list of Practitioners set in the vars.practitionersList variable.
return A FHIR formatted list of MedicationDispence objects or an empty list.
fun buildMedicationStatement (cdaMedicationSections, patientId, medicationRequest, medicationDispense)
Builds a list of FHIR formatted MedicationStatement objects.
param
cdaMedicationSectionsis a list of C-CDA medication sections.
parampatientIdis a string with the patient ID.
parammedicationRequestis a list of FHIR formatted MedicationRequest objects.
parammedicationDispenseis a list of FHIR formatted MedicationDispense objects.
return A FHIR formatted list of MedicationStatement objects or an empty list.
convert-advanceddirective-to-fhir
Converts Advanced Directives section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Consent
DocumentReference
Practitioner
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convert-advanceddirective-to-fhir.dwl
convert-allergyintolerance-to-fhir
Converts Allergy Intolerance section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
AllergyIntolerance
ClinicalImpression
Practitioner
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convert-allergyintolerance-to-fhir.dwl
Functions
fun buildClinicalImpressions (clinicalImpressions, patientId, practitionersList, allergyList)
Builds the ClinicalImpression FHIR objects and returns them as a list.
param
clinicalImpressionsis a list of clinical impression C-CDA objects.
parampatientIdis a string with the patient ID.
parampractitionersListis a list of the C-CDA practitioners.
paramallergyListis a list of FHIR formatted AllergyIntolerance objects.
return A list of FHIR formatted ClinicalImpressions objects.
fun buildAllergies (clinicalImpressions, patientId, practitionersList)
Builds the allergy FHIR objects and returns them as a list.
param
clinicalImpressionsis a list of clinical impression C-CDA objects.
parampatientIdis a string with the patient ID.
parampractitionersListis a list of the C-CDA practitioners.
return A list of FHIR formatted AllergyIntolerance objects.
fun getAllergies (ClinicalImpressions)
Gets a list of allergy objects with the provided list of clinical impressions. Uses getEntryRelationshipResource function from cdaToFHIRTools
param
ClinicalImpressionsis a list of clinical impression objects.
return A list of allergy objects or empty list.
fun getClinicalImpressions (payload)
Gets the clinical impressions with the provided payload. Uses getEntrySection function from cdaToFHIRTools
param
payloadis the input XML CDA request.
return A list of clinical impressions or an empty list.
convert-complication-to-fhir
Converts Complication section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Condition
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convert-complication-to-fhir.dwl
Functions
fun getComplicationSection (payload)
Gets a list of C-CDA complication objects.
param
payloadis the input XML CDA request.
return A list of C-CDA complication objects or an empty list.
fun getComplicationEntries (complicationSection)
Gets a filtered list of C-CDA complication entries.
param
complicationSectionis a list of C-CDA complication objects.
return A filtered list of C-CDA complication entries.
fun buildComplicationConditions (complicationEntries, patientId, practitionersList)
Builds a list of FHIR formatted Condition objects.
param
complicationEntriesis a filtered list of C-CDA complication entries.
parampatientIdis a string with the patient ID.
parampractitionersListis a list of practitioners set as vars.practitionersList.
return A list of FHIR formatted Condition objects or an empty list.
convert-dischargediagnosis-to-fhir
Converts Discharge Diagnosis section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Condition
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convert-dischargediagnosis-to-fhir.dwl
Functions
fun getCdaDischargeDiagnosis (payload)
Gets a list of C-CDA discharge diagnosis objects.
param
payloadis the input XML CDA request.
return A list of C-CDA discharge diagnosis objects or an empty list.
fun getCdaDischargeDiagnosisEntries (cdaDischargeDiagnosis)
Gets a filtered list of C-CDA discharge diagnosis entries.
param
cdaDischargeDiagnosisis a list of C-CDA discharge diagnosis objects.
return A filtered list of C-CDA discharge diagnosis entries.
fun buildDischargeDiagnosisCondition (cdaDischargeDiagnosisEntries, patientId, practitionersList)
Builds a list of FHIR formatted Condition objects.
param
cdaDischargeDiagnosisEntriesis a filtered list of C-CDA discharge diagnosis entries.
parampatientIdis a string with the patient ID.
parampractitionersListis a list of practitioners set as vars.practitionersList.
return A list of FHIR formatted Condition objects or an empty list.
convert-dischargemedications-to-fhir
Converts Discharge Medications section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Condition
Practitioner
Medication
MedicationDispense
MedicationAdministration
Organization
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convert-dischargemedications-to-fhir.dwl
Functions
fun getCdaMedications (payload)
Gets a list of C-CDA medication objects.
param
payloadis the input XML CDA request.
return A list of C-CDA medication objects or an empty list.
fun getCdaMedicationsEntries (cdaDischargeMedications)
Filters and returns a list of C-CDA medication entries.
param
cdaDischargeMedicationsis a list of C-CDA medication objects to filter.
return A filtered list of C-CDA medication entries or an empty list.
fun buildDischargeOrganization (cdaDischargeMedicationsEntries)
Builds a list of FHIR formatted discharge Organization objects.
param
cdaDischargeMedicationsEntriesis a list of C-CDA discharge medication entries.
return A list of FHIR formatted Organization objects or an empty list.
fun buildDischargeMedication (cdaDischargeMedicationsEntries)
Builds a list of FHIR formatted discharge Medication objects.
param
cdaDischargeMedicationsEntriesis a list of C-CDA discharge medication entries.
return A list of FHIR formatted Medication objects or an empty list.
fun buildDischargeMedicationAdministration (cdaDischargeMedicationsEntries, patientId, dischargeMedicationIds)
Builds a list of FHIR formatted discharge MedicationAdministration objects.
param
cdaDischargeMedicationsEntriesis a list of C-CDA discharge medication entries.
parampatientIdis a string with the patient ID.
paramdischargeMedicationIdsis a list of discharge medication IDs.
return A list of FHIR formatted MedicationAdministration objects or an empty list.
fun buildDischargeMedicationCondition (cdaDischargeMedicationsEntries, patientId, practitionersList)
Builds a list of FHIR formatted discharge medication Condition objects.
param
cdaDischargeMedicationsEntriesis a list of C-CDA discharge medication entries.
parampatientIdis a string with the patient ID.
parampractitionersListis a list of practitioners set as vars.practitionersList.
return A list of FHIR formatted medication Condition objects or an empty list.
fun buildDischargeMedicationDispensePractitioner (cdaDischargeMedicationsEntries)
Builds a list of FHIR formatted discharge medication dispense Practitioner objects.
param
cdaDischargeMedicationsEntriesis a list of C-CDA discharge medication entries.
return A list of FHIR formatted discharge medication dispense Practitioner objects or an empty list.
fun buildDischargeMedicationDispense (cdaDischargeMedicationsEntries, patientId, dischargeMedicationIds, dischargeMedicationDispensePractitionersIds)
Builds a list of FHIR formatted discharge MedicationDispense objects.
param
cdaDischargeMedicationsEntriesis a list of C-CDA discharge medication entries.
parampatientIdis a string with the patient ID.
paramdischargeMedicationIdsis a list of discharge medication IDs.
paramdischargeMedicationDispensePractitionersIdsis a list of discharge medication dispense practitioner IDs.
return A list of FHIR formatted discharge MedicationDispense objects or an empty list.
convert-encounter-to-fhir
Converts Encounters section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Practitioner
Encounter
Location
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convert-encounter-to-fhir.dwl
Functions
fun getEncounters (payload)
Gets a list of C-CDA encounter objects with the provided payload.
param
payloadis the input CDA XML request.
return A list of C-CDA encounter objects or an empty array.
fun buildLocations (cdaEncounters)
Builds a list of FHIR formatted Location objects with the provided list of encounters and location ID.
param
cdaEncountersis a list of C-CDA encounter objects.
return A list of FHIR formatted Location objects or a blank list.
fun buildEncounters (cdaEncounters, patientId, locId, practitionerList)
Builds a list of FHIR formatted Encounter objects with the provided arguments.
param
cdaEncountersis a list of C-CDA encounter objects.
parampatientIdis a string with the patient ID.
paramlocIdis a string with the location ID.
parampractitionersListis a list of practitioners.
return a list of FHIR formatted Encounter objects or an empty list.
convert-familyhistory-to-fhir
Converts Family History section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
FamilyHistory
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convert-familyhistory-to-fhir.dwl
Functions
fun buildFamilyHistory (familyHistoryList, fhirFamHistConstants, patientId)
Function to build a list of FamilyHistory FHIR R4 resources using input C-CDA Family History section. Uses getEntrySection from cdaToFHIRTools.
param
familyHistoryListis a list of family history organizer objects.
paramfhirFamHistConstantsis a list of constants used to in FHIR R4 mapping.
parampatientIdis the id of the patient.
return An array of FHIR R4 FamilyHistory resources.
convert-functionalstatus-to-fhir
Converts Functional Status section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Observation
DeviceUseStatement
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convert-functionalstatus-to-fhir.dwl
Functions
fun getCdaFunctionalStatus (payload)
Gets a list of C-CDA functional status objects with the provided payload.
param
payloadis the input XML CDA request.
return A list of C-CDA functional status objects or an empty list.
fun getCdaFunctionalStatusOrganizer (cdaFunctionalStatus)
Gets a list of C-CDA functional status organizer objects with the provided list of C-CDA functional status objects.
param
cdaFunctionalStatusis a list of C-CDA functional status objects.
return A list of C-CDA functional status organizer objects or empty list.
fun buildFunctionalObservations (functionalStatusOrganizer, patientId, perfRefList)
Builds a list of FHIR functional Observation objects with the provided functional status organizer list and patient ID.
param
functionalStatusOrganizeris a C-CDA functional status organizer list of objects.
parampatientIdis a string with the patient ID.
return A list of FHIR formatted Observation objects or an empty list.
fun buildSelfCareObservations (functionalStatusOrganizer, patientId, perfRefList)
Builds a list of FHIR self care Observation objects with the provided functional status organizer list and patient ID.
param
functionalStatusOrganizeris a C-CDA functional status organizer list of objects.
parampatientIdis a string with the patient ID.
return A list of FHIR formatted Observation objects or an empty list.
fun buildSensoryObservations (cdaFunctionalStatus, patientId, perfRefList)
Builds a list of FHIR sensory Observation objects with the provided functional status list and patient ID.
param
cdaFunctionalStatusis a C-CDA functional status list of objects.
parampatientIdis a string with the patient ID.
return A list of FHIR formatted Observation objects or an empty list.
fun buildAssessmentScaleObservations (cdaFunctionalStatus, patientId, perfRefList)
Builds a list of FHIR assessment scale Observation objects with the provided functional status list and patient ID.
param
cdaFunctionalStatusis a C-CDA functional status list of objects.
parampatientIdis a string with the patient ID.
return A list of FHIR formatted Observation objects or an empty list.
fun buildProblemObservations (cdaFunctionalStatus, patientId, perfRefList)
Builds a list of FHIR problem Observation objects with the provided functional status list and patient ID.
param
cdaFunctionalStatusis a C-CDA functional status list of objects.
parampatientIdis a string with the patient ID.
return A list of FHIR formatted Observation objects or an empty list.
fun buildNonMedDeviceSupply (cdaFunctionalStatus, patientId)
Builds a list of FHIR non medical device supply DeviceUseStatment objects with the provided functional status list and patient ID.
param
cdaFunctionalStatusis a C-CDA functional status list of objects.
parampatientIdis a string with the patient ID.
return A list of FHIR formatted Observation objects or an empty list.
fun buildCareGiverCharObservations (cdaFunctionalStatus, patientId, perfRefList)
Builds a list of FHIR care giver Observation objects with the provided functional status list and patient ID.
param
cdaFunctionalStatusis a C-CDA functional status list of objects.
parampatientIdis a string with the patient ID.
return A list of FHIR formatted Observation objects or an empty list.
convert-immunization-to-fhir
Converts Immunization section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Practitioner
Immunization
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convert-immunization-to-fhir.dwl
Functions
fun getCdaImmunizations (payload)
Gets a list of C-CDA immunization objects with the provided payload.
param
payloadis the input XML CDA request.
return A list of C-CDA immunization objects or an empty array.
fun buildImmunizations (cdaImmunizations, patientId, performersList)
Builds a list of FHIR formatted Immunization objects with the provided list of C-CDA immunization objects.
param
cdaImmunizationsis a list of C-CDA immunization objects.
parampatientIdis a string with the patient ID.
paramperformersListis the list of performers.
return A list of FHIR formatted Immunization objects or an empty list.
convert-medicalequipment-to-fhir
Converts Medical Equipment section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Practitioner
Device
Organization
Procedure
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convert-medicalequipment-to-fhir.dwl
Functions
fun buildMedicalEquipment (payload, templateId)
Build the MedicalEquipment Section FHIR objects and returns them as a list.
param
payloadis input XML CDA request.
paramtemplateIdis the Template ID.
return A list of MedicalEquipment Section or an empty list.
fun buildMedicalEquipmentOrganizer (medicalEquipment, templateId)
Build the MedicalEquipmentOrganizer FHIR objects and returns them as a list.
param
medicalEquipmentis a list of MedicalEquipment C-CDA objects.
paramtemplateIdis the Template ID.
return A list of MedicalEquipmentOrganizer list or an empty list.
fun buildNonMedicalSupply (medicalEquipment, templateId)
Build the NonMedicalSupply FHIR objects and returns them as a list.
param
medicalEquipmentis a list of MedicalEquipment C-CDA objects.
paramtemplateIdis the Template ID.
return A list of NonMedicalSupply list or an empty list.
fun buildSupplyResources (medicalEquipmentOrganizer, nonMedicalSupply)
Build the SupplyResources FHIR objects and returns them as a list.
param
medicalEquipmentOrganizeris a list of medicalEquipmentOrganizer C-CDA objects.
paramnonMedicalSupplyis a list of nonMedicalSupply C-CDA objects.
return A list of SupplyResources list or an empty list.
fun buildDeviceList (supplyResources)
Build the DeviceIds FHIR objects and returns them as a list.
param
supplyResourcesis a list of Supply Resources C-CDA objects.
return A list of Device list or an empty list.
fun buildMedicalEquipProcedureList (medicalEquipment)
Build the MedicalEquipProcedure list FHIR objects and returns them as a list.
param
medicalEquipmentis a list of Supply Resources C-CDA objects.
return A list of MedicalEquipProcedure list or an empty list.
fun buildMedEquipPerformers (medicalEquipProcedureList)
Build the MedEquipPerformers list FHIR objects and returns them as a list.
param
medicalEquipProcedureListis a list of Supply Resources C-CDA objects.
return A list of MedEquipPerformers list or an empty list.
fun buildMedEquipPerformersList (medEquipPerformers)
Build the MedEquipPerformers list FHIR objects and returns them as a list.
param
medEquipPerformersis a list of Supply Resources C-CDA objects.
return A list of MedEquipPerformers list or an empty list.
fun buildMedEquipProcedure (medicalEquipProcedureList)
Build the Medical Equipment Procedure list FHIR objects and returns them as a list.
param
medicalEquipProcedureListis a list of Supply Resources C-CDA objects.
return A list of Medical Equipment Procedure list or an empty list.
convert-medication-section-to-fhir
Converts Medications section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Medication
MedicationRequest
MedicationDispense
MedicationStatement
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convert-medication-section-to-fhir.dwl
Functions
fun getCdaMedicationSections (payload)
Gets a list of C-CDA medication sections.
param
payloadis the input XML CDA request.
return A list of C-CDA medication sections or an empty list.
fun buildMedication (cdaMedicationSections)
Builds a FHIR formatted list of Medication objects.
param
cdaMedicationSectionsis a list of C-CDA medication objects.
return A FHIR formatted list of Medication objects or an empty list.
fun buildMedicationRequest (cdaMedicationSections, patientId, medications, practitionersList)
Builds a list of FHIR formatted MedicationRequest objects.
param
cdaMedicationSectionsis a list of C-CDA medication sections.
parampatientIdis a string with the patient ID.
parampractitionersListis a list of Practitioners set in the vars.practitionersList variable.
return A FHIR formatted list of MedicationRequest objects or an empty list.
fun buildMedicationDispense (cdaMedicationSections, patientId, medicationRequest, practitionersList)
Builds a list of FHIR formatted MedicationDispence objects.
param
cdaMedicationSectionsis a list of C-CDA medication sections.
parampatientIdis a string with the patient ID.
parammedicationRequestis a list of FHIR formatted MedicationRequest objects.
parampractitionersListis a list of Practitioners set in the vars.practitionersList variable.
return A FHIR formatted list of MedicationDispence objects or an empty list.
fun buildMedicationStatement (cdaMedicationSections, patientId, medicationRequest, medicationDispense)
Builds a list of FHIR formatted MedicationStatement objects.
param
cdaMedicationSectionsis a list of C-CDA medication sections.
parampatientIdis a string with the patient ID.
parammedicationRequestis a list of FHIR formatted MedicationRequest objects.
parammedicationDispenseis a list of FHIR formatted MedicationDispense objects.
return A FHIR formatted list of MedicationStatement objects or an empty list.
convert-mentalhealth-to-fhir
Converts Mental Health section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Observation
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convert-mentalhealth-to-fhir.dwl
Functions
fun getCdaMentalStatusEntries (payload)
Gets a list of C-CDA mental status entries objects with the provided payload.
param
payloadis the input XML CDA request.
return A list of C-CDA mental status entries objects or an empty list.
fun getCdaAssessmentObservations (cdaMentalStatusEntries)
Gets a list of C-CDA assessment observation objects with the provided payload.
param
cdaMentalStatusEntriesis a list of C-CDA mental status entries.
return A list of C-CDA assessment observation objects or an empty list.
fun buildAssessmentObservation (cdaAssessmentObservations, patientId, perfRefList)
Builds a list of FHIR formatted assessment Observation objects.
param
cdaAssessmentObservationsis a list of C-CDA assessment observation objects.
parampatientIdis a string with the patient ID.
return A list of FHIR formatted assessment Observation objects or an empty list.
fun getCdaMentalStatusObservations (cdaMentalStatusEntries)
Gets a list of C-CDA mental status observation objects with the provided payload.
param
cdaMentalStatusEntriesis a list of C-CDA mental status entries.
return A list of C-CDA mental status observation objects or an empty list.
fun buildMentalStatusObservation (cdaMentalStatusObservations, patientId, perfRefList)
Builds a list of FHIR formatted mental status Observation objects.
param
cdaMentalStatusObservationsis a list of C-CDA mental status observation objects.
parampatientIdis a string with the patient ID.
return A list of FHIR formatted mental status Observation objects or an empty list.
convert-nutrition-to-fhir
Converts Nutrition section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Observation
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convert-nutrition-to-fhir.dwl
Functions
fun getCdaNutritionSections (payload)
Gets a list of C-CDA nutrition section objects.
param
payloadis the input XML CDA request.
return A list of C-CDA nutrition section objects or an empty list.
fun getCdaNutritionObservations (cdaNutritionSections)
Gets a list of C-CDA nutrition observation objects.
param
cdaNutritionSectionsis a list of C-CDA nutrition section objects.
return A list of C-CDA nutrition observation objects or an empty list.
fun getCdaNutritionAssessments (cdaNutritionObservations)
Gets a list of C-CDA nutrition assessment objects.
param
cdaNutritionSectionsis a list of C-CDA nutrition section objects.
return A list of C-CDA nutrition assessment objects or an empty array.
fun buildNutritionObservations (cdaNutritionAssessments, patientId, perfRefList)
Gets a list of FHIR formatted nutrition Observation objects with the provided C-CDA nutrition assessments.
param
cdaNutritionAssessmentsis a list of C-CDA nutrition assessment objects.
parampatientIdis a string with the patient ID.
return A list of FHIR formatted nutrition Observation objects or an empty list.
convert-payer-to-fhir
Converts Payers section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Organization
Coverage
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convert-payer-to-fhir.dwl
Functions
fun getPayersSection (payload)
Gets payer org and from within that, fetch payers and coverage with the provided payload.
param
payloadis the input XML CDA request.
return A array of payers and coverage or empty array.
fun getCoverage (payersSection)
Gets the coverage with the payer org.
param
payersSectionis payers and coverage with the provided payload.
return A list of coverage or an empty list.
fun getPolicy (coverage)
Gets the policy with the payer org.
param
coverageis policy that covers in payer org.
return A list of coverage or an empty list.
fun buildPayers (payersSection)
Creates the list of organizations with the payer org.
param
payersSectionis payers and coverage with the provided payload.
return A list of organizations or an empty list.
fun buildPolicy (policy)
Creates the list of coverage with the payer org.
param
payersSectionis payers and coverage with the provided payload.
return A list of coverage or an empty list.
fun getPayerIds (payers)
Gets the payer id's with the payer org.
param
payersis list of payers in payer org.
return A list of payer id's or empty list.
convert-planoftreatment-to-fhir
Converts Plan of Treatment section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Practitioner
Goal
ServiceRequest
MedicationRequest
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convert-planoftreatment-to-fhir.dwl
Variables
var planSection
Filter payload to fetch various plan section subsets.
Functions
fun getPlanSectionAuthors (plannedObsrv, plannedEncounter, planActs, planProcs, planMedAct, planSupply, planImmAct, planNutritionSect, planGoalObsrv)
Function to extract authors from all planed action sections.
param
plannedObsrvis the list of planned observation.
paramplannedEncounteris the list of planned encounters.
paramplanActsis the list of planned acts.
paramplanProcsis the list of planned procedures.
paramplanMedActis the list of planned medication activity.
paramplanSupplyis the list of planned supply.
paramplanImmActis the list of planned immunization activity.
paramplanNutritionSectis the list of planned nutrition recommendation.
paramplanGoalObsrvis the list of planned goal observation.
fun buildServRequests (servList, fhirServConstants, patientId, refList)
Function to build FHIR R4 Service Requests from Plan of Treatment Section. Uses createServiceRequest function.
param
servListis a list of C-CDA format service requests.
paramfhirServConstantsis a list of constants used for mapping.
parampatientIdis the patient's Id.
paramrefListis a list of practitioner references for author mapping.
return An array of FHIR formatted Service Requests List.
fun buildPlannedMedicationRequests (medReqList, fhirMedConstants, patientId, refList)
Function to build FHIR R4 Planned Medication Requests from Plan of Treatment Section. Uses createServiceRequest function.
param
medReqListis a list of C-CDA format Planned Medication requests.
paramfhirServConstantsis a list of constants used for mapping.
parampatientIdis the patient's Id.
paramrefListis a list of practitioner references for author mapping.
return An array of FHIR formatted Planned Medication Requests List.
fun buildGoal (goalReqs, patientId)
Function to build FHIR R4 Goal Requests from Plan of Treatment Section. Uses createServiceRequest function.
param
goalReqsis a list of C-CDA format Goal requests.
parampatientIdis the patient's Id.
return An array of FHIR formatted Goal objects List.
convert-postoperativediagnosis-to-fhir
Converts PostoperativeDiagnosis section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Condition
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convert-postoperativediagnosis-to-fhir.dwl
Functions
fun getPostoperativeDiagnosisSection (payload)
Gets a list of C-CDA PostoperativeDiagnosis objects.
param
payloadis the input XML CDA request.
return A list of CDA PostoperativeDiagnosis objects or an empty list.
fun getPostoperativeDiagnosisActEntries (postoperativeDiagnosisSection)
Gets a filtered list of C-CDA PostoperativeDiagnosis entries.
param
postoperativeDiagnosisSectionis a list of C-CDA PostoperativeDiagnosis objects.
return A filtered list of C-CDA PostoperativeDiagnosis entries.
fun getPostoperativeDiagnosisObservations (postoperativeDiagnosisActEntries)
Gets a filtered list of C-CDA PostoperativeDiagnosis observations.
param
postoperativeDiagnosisActEntriesis a list of C-CDA PostoperativeDiagnosis entries.
return A filtered list of C-CDA PostoperativeDiagnosis observations objects.
fun buildPostoperativeDiagnosisConditions (postoperativeDiagnosisObservations, patientId, practitionersList)
Builds a list of FHIR formatted PostoperativeDiagnosis Condition objects.
param
postoperativeDiagnosisObservationsis a filtered list of C-CDA PostoperativeDiagnosis observation objects.
parampatientIdis a string with the patient ID.
parampractitionersListis a list of practitioners set as vars.practitionersList.
return A list of FHIR formatted Condition objects or an empty list.
convert-postprocedurediagnosis-to-fhir
Converts Postprocedure Diagnosis section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Condition
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convert-postprocedurediagnosis-to-fhir.dwl
Functions
fun getPostprocedureDiagnosisSection (payload)
Gets a list of C-CDA Postprocedure Diagnosis objects.
param
payloadis the input XML CDA request.
return A list of C-CDA PostprocedureDiagnosis objects or an empty list.
fun getPostprocedureDiagnosisEntries (postprocedureDiagnosisSection)
Gets a filtered list of C-CDA Postprocedure Diagnosis entries.
param
postprocedureDiagnosisSectionis a list of C-CDA PostprocedureDiagnosis objects.
return A filtered list of C-CDA PostprocedureDiagnosis entries.
fun buildPostprocedureDiagnosisConditions (postprocedureDiagnosisEntries, patientId, practitionersList)
Builds a list of FHIR formatted Postprocedure Diagnosis Condition objects.
param
postprocedureDiagnosisEntriesis a filtered list of C-CDA PostprocedureDiagnosis entries.
parampatientIdis a string with the patient ID.
parampractitionersListis a list of practitioners set as vars.practitionersList.
return A list of FHIR formatted Condition objects or an empty list.
convert-preoperativediagnosis-to-fhir
Converts PreoperativeDiagnosis section from CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Condition
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convert-preoperativediagnosis-to-fhir.dwl
Functions
fun getPreoperativeDiagnosisSection (payload)
Gets a list of CDA PreoperativeDiagnosis objects.
param
payloadis the XML CDA request.
return A list of CDA PreoperativeDiagnosis objects or an empty list.
fun getPreoperativeDiagnosisActEntries (preoperativeDiagnosisSection)
Gets a filtered list of CDA PreoperativeDiagnosis entries.
param
preoperativeDiagnosisSectionis a list of CDA PreoperativeDiagnosis objects.
return A filtered list of CDA PreoperativeDiagnosis entries.
fun getPreoperativeDiagnosisObservations (preoperativeDiagnosisActEntries)
Gets a filtered list of CDA PreoperativeDiagnosis observations.
param
preoperativeDiagnosisActEntriesis a list of CDA PreoperativeDiagnosis entries.
return A filtered list of CDA PreoperativeDiagnosis observations objects.
fun buildPreoperativeDiagnosisConditions (preoperativeDiagnosisObservations, patientId, practitionersList)
Builds a list of FHIR formatted Condition objects.
param
preoperativeDiagnosisObservationsis a filtered list of CDA PreoperativeDiagnosis observation objects.
parampatientIdis a string with the patient ID.
parampractitionersListis a list of practitioners set as vars.practitionersList.
return A list of FHIR formatted Condition objects or an empty list.
convert-problem-to-fhir
Converts Problems section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Condition
ClinicalImpression
Practitioner
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convert-problem-to-fhir.dwl
Functions
fun buildConditions (problemConcerns, conditionTemplateId, resourceType, fhirProblemConstants, perfRefList, categoryCode)
Function to build condition FHIR resources using the input C-CDA Observations. Uses function getEntryRelationshipResource to fetch the C-CDA observations list, which is then mapped to FHIR R4 Condition.
param
problemConcernsis a list of C-CDA "act" resource.
paramconditionTemplateIdis the C-CDA templateId for Conditions.
paramresourceTypeis the type of object to be selected for Condition. Example: observation.
paramfhirProblemConstantsis a list of constants used for mapping.
fun buildClinicalImpressions (problemsList, patientId, practList, conditionsList, impressionType)
Function to build condition FHIR resources using the input C-CDA's Act. Uses createClinicalImpression function from cdaToFHIRTools.
param
problemListis the list of C-CDA "act" from the input.
parampatientIdidentifies the id of patient to be used for reference.
convert-procedure-to-fhir
Converts Procedures section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Organization
Practitioner
Procedure
Observation
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convert-procedure-to-fhir.dwl
Functions
fun buildProcedureSection (payload, templateId)
Build the Procedure Section FHIR objects and returns them as a list.
param
payloadis the input XML CDA request.
paramtemplateIdis the Template ID.
return A list of Procedure Section or an empty list.
fun buildProcedureActivityProcedure (procedureSection, templateId)
Build the Procedure Activity Section FHIR objects and returns them as a list.
param
procedureSectionis a list of C-CDA objects.
paramtemplateIdis the Template ID.
return A list of procedure activity or an empty list.
fun buildProcedureObservations (procedureSection, templateId)
Build the procedure observations FHIR objects and returns them as a list.
param
payloadis the input XML CDA request.
paramtemplateIdis the Template ID.
return A list of procedure observation or an empty list.
fun buildProcedureActs (procedureSection, templateId)
Build the procedure observations FHIR objects and returns them as a list.
param
procedureSectionis a list of C-CDA procedure section objects.
paramtemplateIdis the Template ID.
return A list of procedure observation or an empty list.
fun buildProceduresList (procedureActs, procedureActivityProcedure)
Build the procedures list FHIR objects and returns them as a list.
param
performersis a list of C-CDA performers objects.
paramtemplateIdis the Template ID.
return A list of procedure or an empty list.
convert-procedureanesthesia-to-fhir
Converts ProcedureAnesthesia section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Organization
Practitioner
Procedure
Observation
Medication
MedicationAdministration
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convert-procedureanesthesia-to-fhir.dwl
Functions
fun buildProcedureAnesthesiaSection (payload, templateId)
Build the Procedure Anesthesia Section FHIR objects and returns them as a list.
param
payloadis the input XML CDA request.
paramtemplateIdis the Template ID.
return A list of Procedure Anesthesia Section or an empty list.
fun buildProcedureEntries (procedureAnesthesiaSection, templateId)
Build the Procedure Activity Section FHIR objects and returns them as a list.
param
procedureAnesthesiaSectionis a list of C-CDA objects.
paramtemplateIdis the Template ID.
return A list of Procedure objects or an empty list.
fun buildMedicationEntries (procedureAnesthesiaSection, templateId)
Build the Medication Section FHIR objects and returns them as a list.
param
procedureAnesthesiaSectionis a list of C-CDA Medication section objects.
paramtemplateIdis the Template ID.
return A list of Medication objects or an empty list.
fun buildRepresentedOrganization (performers)
Build the represented organization FHIR objects and returns them as a list.
param
performersis a list of C-CDA objects.
return A list of procedure observation or an empty list.
fun buildProceduresList (procedureEntries)
Build the procedures FHIR objects and returns them as a list.
param
procedureEntriesis a list of C-CDA procedure entries.
return A list of procedure or an empty list.
fun buildMedicationAdministration (medicationEntries, patientId, medicationIds)
Builds a list of FHIR formatted MedicationAdministration objects.
param
medicationEntriesis a list of C-CDA medication entries.
parampatientIdis a string with the patient ID.
parammedicationIdsis a list of medication IDs.
return A list of FHIR formatted MedicationAdministration objects or an empty list.
fun buildMedications (medicationEntries)
Builds a list of FHIR formatted Medication objects.
param
medicationEntriesis a list of C-CDA medication entries.
return A list of FHIR formatted Medication objects or an empty list.
convert-procedurefinding-to-fhir
Converts ProcedureFinding section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Condition
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convert-procedurefinding-to-fhir.dwl
Functions
fun getProcedureFindingSection (payload)
Gets a list of C-CDA ProcedureFinding objects.
param
payloadis the input XML CDA request.
return A list of C-CDA ProcedureFinding objects or an empty list.
fun getProcedureFindingEntries (procedureFindingSection)
Gets a filtered list of C-CDA ProcedureFinding entries.
param
procedureFindingSectionis a list of C-CDA ProcedureFinding objects.
return A filtered list of C-CDA ProcedureFinding entries.
fun buildProcedureFindingConditions (procedureFindingEntries, patientId, practitionersList)
Builds a list of FHIR formatted ProcedureFinding Condition objects.
param
procedureFindingEntriesis a filtered list of C-CDA ProcedureFinding entries.
parampatientIdis a string with the patient ID.
parampractitionersListis a list of practitioners set as vars.practitionersList.
return A list of FHIR formatted Condition objects or an empty list.
convert-procedureindications-to-fhir
Converts Procedure Indications section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Observation
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convert-procedureindications-to-fhir.dwl
Functions
fun buildProcedureIndicationsSection (payload, templateId)
Build the Procedure Indications Section FHIR objects and returns them as a list.
param
payloadis input XML CDA request.
paramtemplateIdis the Template ID.
return A list of Procedure Indications or an empty list.
fun buildProcedureIndicationsObservations (procedureIndications, templateId)
Build the Procedure Indications Observations FHIR objects and returns them as a list.
param
socialHistoryis a list of Procedure Indications C-CDA objects.
paramtemplateIdis the Template ID.
return A list of Procedure Indications or an empty list.
convert-reasonforreferral-to-fhir
Creates the Reason for Referral section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
ServiceRequest
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convert-reasonforreferral-to-fhir.dwl
Functions
fun buildServRequests (servList, fhirServConstants, patientId, refList)
Function to build FHIR R4 Service Requests from Plan of Treatment Section. Uses createServiceRequest function.
param
servListis a list of CDA format service requests.
paramfhirServConstantsis a list of constants used for mapping.
parampatientIdis the patient's Id.
paramrefListis a list of practitioner references for author mapping.
return An array of FHIR formatted Service Requests List.
convert-results-to-fhir
Converts Results section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Observation
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convert-results-to-fhir.dwl
Functions
fun buildDiagnosticReportSection (payload, templateId)
Build the Diagnostic Report Section FHIR objects and returns them as a list.
param
payloadis the input XML CDA request.
paramtemplateIdis the Template ID.
return A list of Diagnostic Report Section or an empty list.
fun buildDiagnosticObservations (diagnosticReport, templateId, perfRefList)
Build the Diagnostic Report Observations FHIR objects and returns them as a list.
param
diagnosticReportis a list of Diagnostic Report C-CDA objects.
paramtemplateIdis the Template ID.
return A list of Social History or an empty list.
fun buildDiagnosticObservationIds (diagnosticObservations)
Build the Diagnostic Observations ID objects and returns them as a list.
param
diagnosticObservationsis a list of Diagnostic Report C-CDA objects.
paramtemplateIdis the Template ID.
return A list of Diagnostic Observation IDs or an empty list.
convert-socialhistory-to-fhir
Converts Social History section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Observation
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convert-socialhistory-to-fhir.dwl
Functions
fun buildSocialHistorySection (payload, templateId)
Build the Social History Section FHIR objects and returns them as a list.
param
payloadis the input XML CDA request.
paramtemplateIdis the Template ID.
return A list of Social History Section or an empty list.
fun buildSocialHistoryObservations (socialHistory, templateId)
Build the Social History Observations FHIR objects and returns them as a list.
param
socialHistoryis a list of Social History C-CDA objects.
paramtemplateIdis the Template ID.
return A list of Social History or an empty list.
convert-vitalsigns-to-fhir
Converts Vital Signs section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Observation
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convert-vitalsigns-to-fhir.dwl
Functions
fun buildVitalSignSection (payload, templateId)
Build the VitalSign Section FHIR objects and returns them as a list.
param
payloadis the input XML CDA request.
paramtemplateIdis the Template ID.
return A list of Vital Signs Section or an empty list.
fun buildVitalSignObservations (vitalSigns, templateId, perfRefList)
Build the VitalSign Observations FHIR objects and returns them as a list.
param
vitalSignsis a list of Vital Signs C-CDA objects.
paramtemplateIdis the Template ID.
return A list of Vital Signs or an empty list.
createFHIRR4AllergyIntolerance
This module implements functions to support creation of FHIR R4 AllergyIntolerance.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4AllergyIntolerance.dwl
Functions
fun allergyIntoleranceCategoryLookUp (incode)
Function to lookup C-CDA AllergyIntolerance category type and fetch FHIR type.
param
incodeis C-CDA format code.
return A FHIR format code.
fun allergyIntoleranceTypeLookUp (incode)
Function to lookup C-CDA AllergyIntolerance type and fetch FHIR type.
param
incodeis C-CDA format AllergyIntolerance type code.
return A FHIR format AllergyIntolerance type code.
fun createAllergyIntolerance (allergy, fhirAllergyConstants, allergyId, patientId, practitionerList, allergyStatusCode)
Function to create AllergyIntolerance FHIR object from the input XML CDA Request. Uses getIdentifier function from cdaToFHIRTools.
param
allergyis a object from the CDA input XML, containing AllergyIntolerance information.
paramfhirAllergyConstantsis a list of constants to be used for mapping.
parampatientIdis the patient id.
paramallergyIdis id for the resource.
parampractitionerListis a list of practitioner identifiers and IDs.
return A FHIR format AllergyIntolerance object.
| FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
|---|---|---|
| id | Id generated using GUID for resource | |
| text.status | Constant "generated" | |
| text.div | allergy.text | Narrative that contains a summary of the resource in encoded format |
| identifier.system | allergy.id | Identifier system for resource |
| identifier.value | allergy.id | Identifier value for resource |
| clinicalStatus.coding.system | Constant clinicalStatusSystem from fhirConstants.AllergyIntolerance | |
| clinicalStatus.coding.code | allergy.effectiveTime | Use function getClinicalStatus to lookup code |
| type | allergy.value.code | Identification of the underlying physiological mechanism for a Reaction Risk |
| category | allergy.value.code | Use function allergyIntoleranceCategoryLookUp to lookup category |
| recordedDate | allergy.author.time.value | Format datetime using function formatDateTime |
| recorder.reference | allergy.author.assignedAuthor.id.extension | Lookup practitioner id from practitionerList |
| code.coding.system | Constant codeCodeSystem from fhirConstants.AllergyIntolerance | |
| code.coding.code | allergy.participant.participantRole.playingEntity.code.code | Allergy Intolerance Code |
| code.coding.system | Constant codeCodeSystem from fhirConstants.AllergyIntolerance | |
| code.coding.display | allergy.participant.participantRole.playingEntity.code.displayName | Allergy Intolerance Display Name |
| patient.reference | patientId | Patient ID created from recordTarget |
| reaction.onset | allergy.entryRelationship.observation.effectiveTime.low.value | Reaction Onset Time |
| reaction.substance.coding.code | allergy.entryRelationship.observation.participant.participantRole.playingEntity.code.code | Allergy Substance code |
| reaction.substance.coding.system | Constant codeCodeSystem from fhirConstants.AllergyIntolerance | |
| reaction.substance.coding.display | allergy.entryRelationship.observation.participant.participantRole.playingEntity.code.displayName | Allergy Substance Code Name |
| onsetDateTime | allergy.author.time.value | Format datetime using formatDateTime |
fun getClinicalStatus (effectivedate)
Gets the clinical status field with the provided effective date.
param
effectivedateis an effective date object.
return A string with resolved, active, or inactive.
createFHIRR4ClinicalImpression
This module implements functions to support creation of FHIR R4 ClinicalImpression.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4ClinicalImpression.dwl
Functions
fun createClinicalImpression (clin, patientId, practList, clinId, refList, refType)
Function to create ClincalImpression FHIR object from the input XML CDA Request. Uses getIdentifier function from cdaToFHIRTools.
param
clinis a object from the CDA input XML, containing ClincalImpression information.
paramfhirProblemConstantsis a list of constants to be used for mapping.
parampatientIdis the patient id.
paramclinIdis id for the resource.
parampractListis a list of practitioner identifiers and IDs.
paramrefListis a list of references.
paramrefTypeis a literal of the reference type.
return A FHIR format ClincalImpression object.
| FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
|---|---|---|
| id | Id generated using GUID for resource | |
| text.status | Constant "generated" | |
| text.div | clin.text | Narrative that contains a summary of the resource in encoded format |
| identifier.system | clin.id | Identifier system for resource |
| identifier.value | clin.id | Identifier value for resource |
| status | Constant "completed" | |
| subject.reference | patientId | Patient ID created from recordTarget |
| effectivePeriod.start | clin.effectiveTime.low.value | Clinical Impression Start Date |
| effectivePeriod.end | clin.effectiveTime.high.value | Clinical Impression End Date |
| performer.reference | clin.author.assignedAuthor.id.extension | Lookup practList using the extension for id |
| problem.reference | clin.entryRelationship.observation.id.root | Lookup refList using entryRelationship.observation.id.root for problem reference |
createFHIRR4Composition
This module implements functions to support creation of FHIR R4 Composition.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4Composition.dwl
Functions
fun createCompositionSection (resourceSection, resourceList, compConstants, note)
Function to create section array for composition.
param
resourceSectionis a object from the CDA input XML request, containing Clinical Document Resource information.
paramcompConstantsis a list of constants to be used for mapping.
paramresourceListis a list of FHIR resources converted for the resourceSection.
return An array of section for Composition.
| FHIRR4 Element Name | C-CDA Element Name | Mapping Description |
|---|---|---|
| title | resourceSection.title | Id generated using uuid() for resource |
| text.status | Constant "generated" | |
| text.div | resourceSection.code.displayName or resourceSection.title | Concat with w3org url to create div |
| code.coding.code | resourceSection.code.code | Composition Section Code |
| code.coding.system | resourceSection.code.codeSystem | Use function mapCodeSystem to lookup code system |
| mode | Constant compSectionMode from fhirConstants.Composition | |
| status | Constant compStatus from fhirConstants.Composition | |
| entry.reference | resourceList.resource.resourceType ++ resourceList.resource.id | Create an entry using resourceType and id |
| entry.dispaly | resourceList.resource.code.coding.display | Resource name for section |
fun createCompositionHeader (compId, compHeader, compConstants, practList, patientId, custodianOrgId, encounterId, organizationsList)
Function to create FHIR object from incoming C-CDA Request. Uses getIdentifier function from cdaToFHIRTools.
param
compIdis ID for the resource.
paramcompHeaderis a object from the CDA input XML, containing Clinical Document header information.
paramcompConstantsis a list of constants to be used for mapping.
parampractListis a list of practitioner identifiers and IDs.
parampatientIdis the patient ID.
paramcustodianOrgIdis the Custodian orgId.
paramencounterIdis the Encompassing encounter Id.
paramorganizationsListis a list of organizations identifiers and IDs.
return - FHIR format Composition Header object.
| FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
|---|---|---|
| id | compHeader.setId.extension | ClinicalDocument.setId.extension is used as Composition Id |
| identifier.system | Constant compIdentifierSystem from fhirConstants.Composition | |
| identifier.value | uuid() | Identifier value for resource |
| status | Constant compStatus from fhirConstants.Composition | |
| type.coding.code | compHeader.code.code | Composition Header type code |
| type.coding.dispaly | compHeader.code.displayName | Composition Header type name |
| type.coding.system | compHeader.code.codeSystem | Use function mapCodeSystem to lookup code system |
| date | resource.effectiveTime.value | Format datetime using function formatDateTime |
| author.reference | compHeader.author.assignedAuthor.id.extension | Use parameter practList ++ organizationsList to identify author and organization |
| title | compHeader.title | Composition title |
| confidentiality | compHeader.confidentialityCode.code | Identify confidentiality code for resource |
| attestor.mode | Constant "legal" | |
| attestor.time | compHeader.legalAuthenticator.time.value | Format datetime using function formatDateTime |
| attestor.party.reference | compHeader.legalAuthenticator.assignedEntity.id.extension | Use parameter practList to identify legal authenticator |
| subject.reference | patientId | Id of the patient resource created from recordTarget |
| encounter.reference | encounterId | Encompassing encounter id from parameters |
| custodian.reference | custodianOrgId | Custodian orgId from parameters |
| event.period.start | compHeader.documentationOf.serviceEvent.effectiveTime.low.value | Format datetime using function formatDateTime |
| event.period.end | compHeader.documentationOf.serviceEvent.effectiveTime.high.value | Format datetime using function formatDateTime |
fun buildCompositionResource (compList, compResource, fhirConstants, practList, patientId, custodianOrgId, encompassingEncounterId, organizationsList)
Function to build composition resource. Uses createCompositionHeader function.
param
compListis the list of sections.
paramcompResourceis the C-CDA ClinicalDocument.
paramfhirConstantsis the list of constants used for mapping.
parampractListis the list of practitioner identifiers and IDs.
parampatientIdis the id of the patient.
paramcustodianOrgIdis the id for the Custodian organization.
paramencompassingEncounterIdis the id for the encompassing encounter if present.
paramorganizationsListis the list of organization identifiers and IDs.
paramsectionListis the list of sections in the C-CDA document.
return A FHIR R4 formated Composition Resource.
fun getCDASection (body, templateId)
Function to get CDA Section from C-CDA Document. Filters the input to match the templateId and returns the first section.
param
bodyis the input C-CDA request's component.
paramtemplateIdis used to match the template.
return An Object with the section of the C-CDA or an empty object.
createFHIRR4Condition
This module implements functions to support creation of FHIR R4 Condition.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4Condition.dwl
Functions
fun createCondition (cond, fhirProblemConstants, patientId, practList, condId, categoryCode)
Function to create Condition FHIR object from the input XML CDA Request. Uses getIdentifier,formatDateTime and mapCodeSystem functions from cdaToFHIRTools.
param
condis a object from the CDA input XML, containing Condition information.
paramfhirProblemConstantsis a list of constants to be used for mapping.
parampatientIdis the patient ID.
paramcondIdis ID for the resource.
parampractListis a list of practitioner identifiers and IDs.
return A FHIR format Condition object.
| FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
|---|---|---|
| id | Id generated using GUID for resource | |
| text.status | Constant "generated" | |
| text.div | cond.text | Narrative that contains a summary of the resource in encoded format |
| identifier.system | cond.id | Identifier system for resource |
| identifier.value | cond.id | Identifier value for resource |
| clinicalStatus.coding.code | cond.effectiveTime.high.value | Conditionally set to "active" or "resolved" |
| clinicalStatus.coding.system | Constant problemClinicalStatusSystem from fhirConstants.Problem | |
| category.coding.code | parentSection.code | Condition category Code |
| category.coding.system | Use function conditionCategory to lookup code system name | |
| category.coding.display | Condition category display name | |
| code.coding.code | cond.value.code | Condition Code |
| code.coding.system | cond.value.codeSystem | Use function mapCodeSystem to lookup code system name |
| code.coding.display | cond.value.displayName | Condition display name |
| subject.reference | patientId | Patient ID created from recordTarget |
| onsetDateTime | cond.effectiveTime.low.value | Format datetime using function formatDateTime |
| recordedDate | cond.author.time.value | Format datetime using function formatDateTime |
| recorder.reference | cond.author.assignedAuthor.id.extension | Filter practList to get id match |
createFHIRR4Consent
This module implements functions to support creation of FHIR R4 Consent.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4Consent.dwl
Functions
fun createConsent (advDirectiveArray, patientId, docId, practRefArray, fhirConsentConstants)
Function to create Consent FHIR object from the input XML CDA Request. Uses getIdentifier function from cdaToFHIRTools.
param
advDirectiveArrayis an array from the CDA input XML, containing Consent information.
paramfhirConsentConstantsis a list of constants to be used for mapping.
parampatientIdis the patient ID.
paramdocIdis the reference to DocumentReference resource.
parampractRefArrayis a list of practitioner identifiers and IDs.
return A FHIR format Consent object.
| FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
|---|---|---|
| id | Id generated using GUID for resource | |
| text.status | Constant "generated" | |
| text.div | advObs.text | Narrative that contains a summary of the resource in encoded format |
| identifier.system | advDir.id | Identifier system for resource |
| identifier.value | advDir.id | Identifier value for resource |
| status | advObs.effectiveTime.high | Conditionally set to "active" |
| scope.coding.system | Constant consentScopeCodingSystem from fhirConstants.Consent | |
| scope.coding.code | Constant consentScopeCodingCode from fhirConstants.Consent | |
| category.coding.code | advDir.code.code | Consent Category Code |
| category.coding.system | Constant categorySystem from fhirConstants.Consent | |
| dateTime | advObs.effectiveTime.low | Format datetime using function formatDateTime |
| provision.code.code | advObs.value.code | Consent provision code |
| provision.code.display | advObs.value.displayName | Consent provision code name |
| provision.code.system | Constant provisionCodeSystem from fhirConstants.Consent | |
| subject.reference | patientId | Patient ID created from recordTarget |
| sourceReference.reference | docId | Document Reference provided as parameter to the function |
| performer.reference | advObs.author.assignedAuthor.id | Use function getPractitionerRef to get practitioner id |
createFHIRR4Coverage
This module implements functions to support creation of FHIR R4 Coverage.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4Coverage.dwl
Functions
fun createCoverage (cov, fhirCoverageConstants, covId, patientId, payers)
Function to create Coverage FHIR object from the input XML CDA Request. Uses getIdentifier function from cdaToFHIRTools.
param
covis an object from the CDA input XML, containing Coverage information.
paramfhirCoverageConstantsis a list of constants to be used for mapping.
paramcovIdis the ID for the resource.
return A FHIR format Coverage object.
| FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
|---|---|---|
| id | Id generated using GUID for resource | |
| text.status | Constant "generated" | |
| text.div | cov.text | Narrative that contains a summary of the resource in encoded format |
| identifier.system | cov.id | Identifier system for resource |
| identifier.value | cov.id | Identifier value for resource |
| status | cov.performer.time.high.value | Conditionally set to "active or cancelled" |
| type.coding.system | Constant selfPayTypeCodeSystem from fhirConstants.Coverage | |
| type.coding.code | cov.code.code | Conditionally set to "pay" |
| type.coding.display | cov.code.code | Conditionally set to "PAY" |
| beneficiary.reference | patientId | Patient ID created from recordTarget |
| payor.reference | Payer or Org Ref | If cov.code.code is 81(SelfPay)then it is Patient Ref else Insurance Org Ref |
fun mapCodeableConcept4CoverageType (codeableConceptObj)
Maps mapCodeableConcept4CoverageType from C-CDA format to FHIR format.
param
codeableConceptObjC-CDA codeableConcept Object.
return A string of coding element within the codeableConcept object, located in the type field of the coverage resource in FHIR format.
createFHIRR4Device
This module implements functions to support creation of FHIR R4 Device.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4Device.dwl
Functions
fun createDevice (device, fhirDeviceConstants, deviceId)
Function to create Device FHIR object from the input XML CDA Request. Uses getIdentifier function from cdaToFHIRTools.
param
deviceis an object from the CDA input XML, containing Device information.
paramfhirDeviceConstantsis a list of constants to be used for mapping.
paramdeviceIdis the ID for the resource.
return A FHIR format Device object.
| FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
|---|---|---|
| id | Id generated using GUID for resource | |
| text.status | Constant "generated" | |
| text.div | device.text | Narrative that contains a summary of the resource in encoded format |
| identifier.system | device.id | Identifier system for resource |
| identifier.value | device.id | Identifier value for resource |
| type.code | device.participant.participantRole.playingDevice.code.code | Device Type Code |
| type.displayName | device.participant.participantRole.playingDevice.code.displayName | Device Type Code Name |
| type.system | Constant deviceCodeSystem from fhirConstants.Device | |
| manufacturer | device.participant.participantRole.scopingEntity.desc | Device manufacturer name |
createFHIRR4DeviceUseStatement
This module implements functions to support creation of FHIR R4 DeviceUseStatement.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4DeviceUseStatement.dwl
Functions
fun createDeviceUseStatement (supply, fhirDeviceUseConstants, supplyId, patientId)
Function to create DeviceUseStatement FHIR object from the input XML CDA Request. Uses getIdentifier function from cdaToFHIRTools.
param
supplyis an object from the CDA input XML, containing DeviceUseStatement information.
paramfhirDeviceUseConstantsis a list of constants to be used for mapping.
paramsupplyIdis the ID for the resource.
parampatientIdis the patient ID.
return A FHIR format DeviceUseStatement object.
| FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
|---|---|---|
| id | Id generated using GUID for resource | |
| text.status | Constant "generated" | |
| text.div | supply.text | Narrative that contains a summary of the resource in encoded format |
| identifier.system | supply.id | Identifier system for resource |
| identifier.value | supply.id | Identifier value for resource |
| status | supply.statusCode.code | Device Use Statement Status Code |
| subject.reference | patientId | Patient ID created from recordTarget |
| device.coding.code | supply.participant.participantRole.playingDevice.code.code | Device Code |
| device.coding.display | supply.participant.participantRole.playingDevice.code.displayName | Device Code Name |
| device.coding.display | Constant deviceCodeSystem from fhirConstants.DeviceUseStatement |
createFHIRR4DiagnosticReport
This module implements functions to support creation of FHIR R4 DiagnosticReport.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4DiagnosticReport.dwl
Functions
fun diagnosticReportStatusLookup (inCode)
Function to lookup diagnostic report status.
param
inCodeis the C-CDA format code.
return A FHIR formatted code.
fun createDiagnosticReport (diagnostic, fhirDiagRepConstants, patientId, diagId, diagnosticObservationIds)
Function to create DiagnosticReport FHIR object from the input XML CDA Request. Uses getIdentifier,formatDateTime and mapCodeSystem functions from cdaToFHIRTools.
param
diagnosticis an object from the CDA input XML, containing DiagnosticReport information.
paramfhirDiagRepConstantsis a list of constants to be used for mapping.
paramdiagIdis the ID for diagnostic report resource.
parampatientIdis the patient ID.
paramdiagnosticObservationIdsis a list of observation IDs.
return A FHIR format DiagnosticReport object.
| FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
|---|---|---|
| id | Id generated using GUID for resource | |
| text.status | Constant "generated" | |
| text.div | diagnostic.text | Narrative that contains a summary of the resource in encoded format |
| identifier.system | diagnostic.id | Identifier system for resource |
| identifier.value | diagnostic.id | Identifier value for resource |
| status | diagnostic.organizer.statusCode.code | Use function diagnosticReportStatusLookup to lookup status |
| code.coding.code | diagnostic.organizer.code.code | Diagnostic Report Code |
| code.coding.display | diagnostic.organizer.code.displayName | Diagnostic Report Code Name |
| code.coding.system | diagnostic.organizer.code.codeSystem | Use function mapCodeSystem to lookup Diagnostic Report Code System |
| effectivePeriod.start | diagnostic.organizer.effectiveTime.low.value | Format datetime using function formatDateTime |
| effectivePeriod.end | diagnostic.organizer.effectiveTime.high.value | Format datetime using function formatDateTime |
| effectiveDateTime | diagnostic.organizer.effectiveTime.value | Format datetime using function formatDateTime |
| subject.reference | patientId | Patient ID created from recordTarget |
| result.reference | diagnostic.organizer.component.observation | Filter diagnosticObservationIds to match current observation |
createFHIRR4DocumentReference
This module implements functions to support creation of FHIR R4 DocumentReference.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4DocumentReference.dwl
Functions
fun createDocumentRef (advDirective, fhirDocRefConstants)
Function to create DocumenatReference FHIR object from the input XML CDA Request.
param
advDirectiveis an object from the CDA input XML, containing Documentation information.
paramfhirDocRefConstantsis a list of constants used for mapping.
return A FHIR format DocumentReference object.
| FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
|---|---|---|
| id | Id generated using GUID for resource | |
| text.status | Constant "generated" | |
| text.div | advObs.text | Narrative that contains a summary of the resource in encoded format |
| status | advObs.effectiveTime.high | Conditionally set to "current" |
| content.attachment.contentType | advObs.reference.externalDocument.text.mediaType | Content type for Document |
| content.attachment.url | advObs.reference.externalDocument.text.reference.value | URL for Document |
fun createDocumentRefUCDA (ucdaObj, mediaType, patientId, custodianOrgId, practList, organizationsList)
Function to create DocumenatReference FHIR object from the input XML Unstructured CDA Request.
param
ucdaObjis an object from the CDA input XML, containing Documentation information.
parammediaTypeis mediaType of the document.
return A FHIR format DocumentReference object.
| FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
|---|---|---|
| id | Id generated using GUID for resource | |
| text.status | Constant "generated" | |
| text.div | advObs.text | Narrative that contains a summary of the resource in encoded format |
| status | advObs.effectiveTime.high | Conditionally set to "current" |
| content.attachment.contentType | advObs.reference.externalDocument.text.mediaType | Content type for Document |
| content.attachment.url | advObs.reference.externalDocument.text.reference.value | URL for Document |
createFHIRR4Encounter
This module implements functions to support creation of FHIR R4 Encounter.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4Encounter.dwl
Functions
fun createEncounter (encounterObj, fhirEncounterConstants, encounterId, patientId, practitioners, locations)
Function to create Encounter FHIR object from the input XML CDA Request. Uses getIdentifier function from cdaToFHIRTools.
param
encounterObjis an object from the CDA input XML, containing Encounter information.
paramfhirEncounterConstantsis a list of constants to be used for mapping.
paramencounterIdis the ID for the resource.
parampatientIdis the patient ID.
parampractitionersis a list of practitioner IDs and identifiers.
return A FHIR format Encounter object.
| FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
|---|---|---|
| id | Id generated using GUID for resource | |
| text.status | Constant "generated" | |
| text.div | encounterObj.text | Narrative that contains a summary of the resource in encoded format |
| identifier.system | encounterObj.id | Identifier system for resource |
| identifier.value | encounterObj.id | Identifier value for resource |
| status | Constant status from fhirConstants.Encounter | |
| class.code | encounterObj.translation.code | Encounter class code |
| class.display | encounterObj.translation.displayName | Encounter class code name |
| class.system | encounterObj.translation.codeSystem | Encounter class code system name |
| type.coding.code | encounterObj.code.code | Encounter type code |
| type.coding.display | encounterObj.code.displayName | Encounter type code name |
| type.coding.system | encounterObj.code.codeSystem | Encounter type code system name |
| subject.reference | patientId | Patient ID created from recordTarget |
| participant.type.system | Constant participantTypeSystem from fhirConstants.Encounter | |
| participant.type.code | Constant participantTypeCode from fhirConstants.Encounter | |
| participant.individual.reference | encounterObj.performer.assignedEntity.id.extension | Lookup practitionerId from practitioners |
| location.location.reference | location.location | Map locations from location parameter |
fun createEncompassingEncounter (encounterObj, fhirEncounterConstants, encounterId, patientId, practitioners, location)
Function to create Encounter FHIR object from incoming C-CDA Request. Uses getIdentifier function from cdaToFHIRTools.
param
encounterObjis an object from the CDA input XML, containing Encounter information.
paramfhirEncounterConstantsis a list of constants to be used for mapping.
paramencounterIdis the ID for the resource.
parampatientIdis the patient ID.
parampractitionersis a list of practitioner ID and identifiers.
paramlocationis the id of the location of encounter.
return A FHIR format Encounter object.
| FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
|---|---|---|
| id | Id generated using uuid() for resource | |
| identifier.system | encounterObj.id | Identifier system for resource |
| identifier.value | encounterObj.id | Identifier value for resource |
| status | Constant status from fhirConstants.Encounter | |
| class.code | encounterObj.translation.code | Encounter class code |
| class.display | encounterObj.translation.displayName | Encounter class code name |
| class.system | encounterObj.translation.codeSystem | Encounter class code system name |
| type.coding.code | encounterObj.code.code | Encounter type code |
| type.coding.display | encounterObj.code.displayName | Encounter type code name |
| type.coding.system | encounterObj.code.codeSystem | Encounter type code system name |
| period.start | encounterObj.effectiveTime.low.value | Format datetime using function formatDateTime |
| period.end | encounterObj.effectiveTime.high.value | Format datetime using function formatDateTime |
| subject.reference | patientId | Patient ID created from recordTarget |
| hospitalization.dischargeDisposition.code | encounterObj.dischargeDispositionCode.code | Conditionally set to "home" |
| hospitalization.dischargeDisposition.display | encounterObj.dischargeDispositionCode.displayName | Conditionally set to "Home" |
| hospitalization.dischargeDisposition.system | Constant dischargeDispositionCodeSystem from fhirConstants.Encounter | |
| participant.type.system | Constant participantTypeSystem from fhirConstants.Encounter | |
| participant.type.code | Constant participantTypeCode from fhirConstants.Encounter | |
| participant.individual.reference | encounterObj.performer.assignedEntity.id.extension | Lookup practitionerId from practitioners |
| location.location.reference | location.location | Map locations from location parameter |
fun mapCodeableConcept4EncounterDischargeDisposition (codeableConceptObj)
Maps mapCodeableConcept4CoverageType from C-CDA format to FHIR format.
param
codeableConceptObjC-CDA codeableConcept Object.
return A string of coding element within the codeableConcept object, located in the type field of the coverage resource in FHIR format.
createFHIRR4FamilyHistory
This module implements functions to support creation of FHIR R4 FamilyHistory.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4FamilyHistory.dwl
Functions
fun createFamilyHistory (history, fhirHistoryConstants, histId, patientId)
Function to create FamilyHistory FHIR object from the input XML CDA Request. Uses getIdentifier function from cdaToFHIRTools.
param
historyis an object from the CDA input XML, containing FamilyHistory information.
paramfhirHistoryConstantsis a list of constants to be used for mapping.
paramhistIdis the ID for the resource.
parampatientIdis the patient ID.
return A FHIR formatted FamilyHistory object.
| FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
|---|---|---|
| id | Id generated using GUID for resource | |
| text.status | Constant "generated" | |
| text.div | history.text | Narrative that contains a summary of the resource in encoded format |
| identifier.system | history.id | Identifier system for resource |
| identifier.value | history.id | Identifier value for resource |
| status | Constant "completed" | |
| relationship.code | history.subject.relatedSubject.code.translation.code | Relationship Code to Patient |
| relationship.display | history.subject.relatedSubject.code.translation.displayName | Relationship Name to Patient |
| relationship.system | Constant codeSystem from fhirConstants.FamilyHistory | |
| sex.code | history.subject.relatedSubject.subject.administrativeGenderCode.code | Family Member Gender Code |
| sex.display | history.subject.relatedSubject.subject.administrativeGenderCode.displayName | Family Member Gender Display |
| sex.system | history.subject.relatedSubject.subject.administrativeGenderCode.codeSystem | Family Member Gender Code System |
| bornString | history.subject.relatedSubject.subject.birthTime.value | Family Member BirthTime |
| condition.code | history.component.observation.value.code | Family Member Condition Code |
| condition.display | history.component.observation.value.displayName | Family Member Condition Display |
| condition.system | Constant codeSystem from fhirConstants.FamilyHistory | |
| condition.contributedToDeath | Conditionally set to true if deathObservationTemplateId is found in Observation | |
| condition.onsetAge.value | history.component.observation.entryRelationship.observation.value.value | Onset Age for condition |
| condition.onsetAge.system | Constant unitOfMeasureSystem from fhirConstants.FamilyHistory | |
| condition.onsetAge.code | history.component.observation.entryRelationship.observation.value.unit | Onset Age Condition Code |
| patient.reference | patientId | Patient ID created from recordTarget |
createFHIRR4Goal
This module implements functions to support creation of FHIR R4 Goal.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4Goal.dwl
Functions
fun createGoal (goal, goalId, patientId)
Function to create Goal FHIR object from the input XML CDA Request. Uses getIdentifier and formatDateTime functions from cdaToFHIRTools.
param
goalis an object from the CDA input XML, containing Goal information.
paramgoalIdis the ID for the resource.
parampatientIdis the patient ID.
return A FHIR formatted Goal object.
| FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
|---|---|---|
| id | Id generated using GUID for resource | |
| text.status | Constant "generated" | |
| text.div | goal.text | Narrative that contains a summary of the resource in encoded format |
| identifier.system | goal.id | Identifier system for resource |
| identifier.value | goal.id | Identifier value for resource |
| description.code | goal.code.code | Goal Description Code |
| description.display | goal.code.displayName | Goal Description Code Name |
| lifecycleStatus | goal.statusCode.code | Goal Status |
| subject.reference | patientId | Patient Id created from recordTarget |
| startDate | goal.effectveTime | Format datetime using function formatDateTime |
createFHIRR4Immunization
This module implements functions to support creation of FHIR R4 Immunization.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4Immunization.dwl
Functions
fun createImmunization (immItem, fhirConstants, immunizationId, patientId, performers)
Creates a FHIR Immunization object with the provided C-CDA substanceAdministration item, patient ID, and performer reference. Uses getIdentifier function from cdaToFHIRTools.
param
immItemis a substanceAdministration C-CDA object.
paramfhirConstantsis a list of constants used for mapping.
paramimmunizationIdis ID used for the resource.
parampatientIdis a String with the patient ID to use.
paramperformersis a list of Practitioners, PractitionerRole, or Organization to use as the performer reference.
return A FHIR formatted Immunization object.
| FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
|---|---|---|
| id | Id generated using GUID for resource | |
| text.status | Constant "generated" | |
| text.div | immItem.text | Narrative that contains a summary of the resource in encoded format |
| identifier.system | immItem.id | Identifier system for resource |
| identifier.value | immItem.id | Identifier value for resource |
| status | immItem.statusCode.code | Use function mapImmunizationStatus to lookup status |
| manufacturer | immItem.consumable.manufacturedProduct.manufacturerOrganization.id.root | Use function mapImmunizationManufacturer for mapping |
| lotNumber | immItem.consumable.manufacturedProduct.manufacturedMaterial.lotNumberText | Immunization substance lot number |
| vaccineCode | immItem.consumable.manufacturedProduct.manufacturedMaterial.code.code | Use function mapImmunizationVaccineCode for mapping |
| patient.reference | patientId | Patient ID created from recordTarget |
| performer.actor.reference | immItem.performer.assignedEntity.id.extension | Lookup performer id from input parameter performers |
| occurenceString | immItem.effectiveTime.value | Format datetime using formatDateTime |
| site | immItem.approachSiteCode.code | Use function mapImmunizationSite for mapping |
| route | immItem.routeCode.code | Use function mapImmunizationRoute for mapping |
| doseQuantity | immItem.doseQuantity.center.value | Immunization dose quantity |
| note.text | immItem.text | Immunization note |
| reaction | immItem | Use function mapImmunizationReaction with object detailed in the function |
fun mapImmunizationStatus (code)
Maps the immunization status code.
param
codeis a String with the C-CDA status code.
return A String with the FHIR status code.
fun getImmunizationCvxDisplay (code)
Maps the CVX immunization vaccine code provided to a display string.
param
codeis a String with the CVX immunization vaccine code.
return A String with the display or blank if not matched.
fun getImmunizationOidDisplay (code)
Maps the OID immunization vaccine code provided to a display string.
param
codeis a String with the OID immunization vaccine code.
return A String with the display or blank if not matched.
fun mapImmunizationManufacturer (id)
Maps the immunization manufacturer ID to an organization reference.
param
idis a String with the organization ID.
return A FHIR formatted Organization object reference.
fun mapImmunizationSite (code)
Maps the immunization site code to the FHIR formatted site CodeableConcept object.
param
codeis a String with the code to map.
return A CodeableConcept object with the site code or null if not matched.
fun mapImmunizationRoute (code)
Map the immunization route code to the FHIR formatted CodeableConcept object.
param
codeis a String with the route code.
return A CodeableConcept object with the route code or null if not matched.
fun mapImmunizationReaction (item)
Maps the immunization item to the FHIR formatted immunization reaction list.
param
itemis a substanceAdministration object to map from.
return A FHIR formatted reaction list, or null if not found.
fun mapImmunizationGetReactionObs (item)
Gets the list of reaction observations with the provided substanceAdministration object.
param
itemis a substanceAdministration object.
return A list of reactions observations.
fun mapCodeableConcept4ImmunizationVaccineCode (codeableConceptObj)
Maps mapCodeableConcept4ImmunizationVaccineCode from C-CDA format to FHIR format.
param
codeableConceptObjC-CDA codeableConcept Object.
return A string of coding element within the codeableConcept object, located in the type field of the coverage resource in FHIR format.
createFHIRR4Location
This module implements functions to support creation of FHIR R4 Location.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4Location.dwl
Functions
fun createLocation (location, fhirLocationsConstants, locId)
Function to create Location FHIR object from the input XML CDA Request.
param
locationis an object from the CDA input XML, containing Location information.
paramfhirLocationsConstantsis a list of constants to be used for mapping.
paramlocIdis the ID for location resource.
return A FHIR formatted MedicationDispense object.
| FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
|---|---|---|
| id | Id generated using GUID for resource | |
| text.status | Constant "generated" | |
| text.div | location.text | Narrative that contains a summary of the resource in encoded format |
| name | location.playingEntity.name | Location Name |
| address.use | location.addr.use | Location Address Use |
| address.line | location.addr.streetAddressLine | Location Address Line |
| address.city | location.addr.city | Location Address City |
| address.state | location.addr.state | Location Address State |
| address.country | location.addr.country | Location Address Country |
| address.postalCode | location.addr.postalCode | Location Address Postal Code |
| address.period.start | location.addr.useablePeriod.low.value | Location Address used period start date |
| address.period.end | location.addr.useablePeriod.high.value | Location Address used period end date |
| telecom.system | Used telecomSystemLookup to lookup system value | |
| telecom.value | location.telecom.value | Location's communication details |
| telecom.use | location.telecom.use | Used telecomUseLookup function to lookup telecom use value |
| telecom.period.start | location.telecom.useablePeriod.low.value | Telecom system used period start date |
| telecom.period.end | location.telecom.useablePeriod.high.value | Telecom system used period end date |
| type.code | location.code.code | Location Type Code |
| type.system | location.code.codeSystem | Location Type Code System |
| type.display | location.code.displayName | Location Type Name |
createFHIRR4Medication
This module implements functions to support creation of FHIR R4 Medication.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4Medication.dwl
Functions
fun createMedication (med, fhirConstants, medId)
Function to create Medication FHIR object from the input XML CDA Request with parameters medicationObject, organizationId. Uses getIdentifier function from cdaToFHIRTools.
param
medis an object from the CDA input XML, containing Medication information.
paramfhirConstantsis a list of constants used for mapping.
parammedIdis the ID used for resource.
return A FHIR format Medication object.
| FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
|---|---|---|
| id | Id generated using GUID for resource | |
| text.status | Constant "generated" | |
| text.div | med.text | Narrative that contains a summary of the resource in encoded format |
| code.code | med.consumable.manufacturedProduct.manufacturedMaterial.code.code | Medication Code |
| code.display | med.consumable.manufacturedProduct.manufacturedMaterial.code.displayName | Medication Name |
| code.system | Constant medicationCodeSystem from fhirConstants.Medication |
createFHIRR4MedicationAdministration
This module implements functions to support creation of FHIR R4 MedicationAdministration.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4MedicationAdministration.dwl
Functions
fun createMedicationAdministration (medAdmn, fhirMedAdmnConstants, patientId, medAdmnId, dischargeMedicationId)
Function to create MedicationAdministration FHIR object from the input XML CDA Request. Uses functions getIdentifier,formatDateTime,medAdmnStatusLookup from cdaToFHIRTools.
param
medAdnmis the C-CDA medication administration resource.
paramfhirMedAdmnConstantsis a list of constants for mapping.
parampatientIdis a reference to a Patient.
parammedAdmnIdis the id for MedicationAdministration.
paramdischargeMedicationIdis the discharge medication id.
return - FHIR formatted MedicationAdministration object.
| FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
|---|---|---|
| id | Id generated using GUID for resource | |
| text.status | Constant "generated" | |
| text.div | medAdmn.text | Narrative that contains a summary of the resource in encoded format |
| identifier.system | medAdmn.id | Identifier system for resource |
| identifier.value | medAdmn.id | Identifier value for resource |
| status | medAdmn.statusCode.code | Use function medAdmnStatusLookup to lookup status |
| effectivePeriod.start | medAdmn.effectiveTime.low.value | Format datetime using function formatDateTime |
| effectivePeriod.end | medAdmn.effectiveTime.high.value | Format datetime using function formatDateTime |
| medicationReference.reference | dischargeMedicationId | Map the dischargeMedicationId as a reference |
| subject.reference | patientId | Patient ID created from recordTarget |
| dosage.route.coding.system | Constant dosageRouteCodeSystem from fhirConstants.MedicationAdminstration | |
| dosage.route.coding.code | medAdmn.routeCode.code | Medication Administration route code |
| dosage.route.coding.display | medAdmn.routeCode.displayName | Medication Administration route Code Name |
| dosage.dose.value | medAdmn.doseQuantity.value | Medication Adminstration Dose Quantity |
| dosage.rateQuantity.value | medAdmn.rateQuantity.value | Medication Adminstration Dosage Rate Quantity |
createFHIRR4MedicationDispense
This module implements functions to support creation of FHIR R4 MedicationDispense.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4MedicationDispense.dwl
Functions
fun createMedicationDispense (medDisp, fhirMedDispConstants, patientId, medDispId, medicationRequests, practitioners, medDispIdx, medications)
Function to create MedicationDispense FHIR object from the input XML CDA Request.
param
medDispis an object from the CDA input XML, containing MedicationDispense information.
paramfhirMedDispConstantsis a list of constants to be used for mapping.
parampatientIdis a reference to a Patient.
parammedDispIdis the ID for medication dispense resource.
parammedicationRequestsis a list of medication requests.
parampractitionersis a list of practitioner identifier and IDs.
return A FHIR formatted MedicationDispense object.
| FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
|---|---|---|
| id | Id generated using GUID for resource | |
| text.status | Constant "generated" | |
| text.div | medDisp.text | Narrative that contains a summary of the resource in encoded format |
| identifier.system | medDisp.id | Identifier system for resource |
| identifier.value | medDisp.id | Identifier value for resource |
| intent | Constant set to "order" | |
| status | medDisp.statusCode.code | Medication Dispense status |
| whenPrepared | medDisp.effectiveTime.low.value | Medication dispense prepared |
| whenHandedOver | medDisp.effectiveTime.high.value | Medication dispense handed over |
| quantity.value | medDisp.quantity.value | Medication dispensed quantity |
| subject.reference | patientId | Patient ID created from recordTarget |
| medicationReference.reference | Medication Reference | |
| performer.actor.reference | performer.assignedEntity.id.extension | Use parameter practitioners to filter for practitioner id |
| authorizingPrescription.reference | Use function getMedReferenceId and parameter medicationRequests to filter medicationRequestId |
fun createDischargeMedicationDispense (medDisp, patientId, medDispId, medicationId, practitioners)
Function to create DischargeMedicationDispense FHIR object from incoming C-CDA Request.
param
medDispis an object from the CDA input XML, containing MedicationDispense information.
parampatientIdis a reference to a Patient.
parammedDispIdis the ID for medication dispense resource.
parammedicationRequestsis a list of medication requests.
parampractitionersis a list of practitioner identifiers and IDs.
return A FHIR formatted MedicationDispense object.
| FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
|---|---|---|
| id | Id generated using uuid() for resource | |
| identifier.system | resource.id | Identifier system for resource |
| identifier.value | resource.id | Identifier value for resource |
| intent | Constant set to "order" | |
| status | resource.statusCode.code | Medication Dispense status |
| whenPrepared | resource.effectiveTime.low.value | Medication dispense prepared |
| whenHandedOver | resource.effectiveTime.high.value | Medication dispense handed over |
| quantity.value | resource.quantity.value | Medication dispensed quantity |
| subject.reference | patientId | Patient ID created from recordTarget |
| medication.reference.reference | medicationId | Medication reference id |
| performer.actor.reference | performer.assignedEntity.id.extension | Practitioner reference for medication dispense |
createFHIRR4MedicationRequest
This module implements functions to support creation of FHIR R4 MedicationRequest.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4MedicationRequest.dwl
Functions
fun createMedicationRequest (medicationRequest, fhirMedReqConstants, patientId, medReqId, practitioners, medications, medReqIdx)
Function to create MedicationRequest FHIR object from the input XML CDA Request.
param
medicationRequestis an object from the CDA input XML, containing MedicationRequest information.
paramfhirMedReqConstantsis a list of constants used for mapping.
parampatientIdis a reference to a Patient.
parammedReqIdis ID for medication request.
parampractitionersis a list of practitioner identifier and IDs.
return A FHIR formatted MedicationRequest object.
| FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
|---|---|---|
| id | Id generated using GUID for resource | |
| text.status | Constant "generated" | |
| text.div | medicationRequest.text | Narrative that contains a summary of the resource in encoded format |
| identifier.system | medicationRequest.id | Identifier system for resource |
| identifier.value | medicationRequest.id | Identifier value for resource |
| intent | Constant set to "order" | |
| status | medicationRequest.statusCode.code | Medication request status |
| subject.reference | patientId | Patient ID created from recordTarget |
| medicationReference.reference | Medication reference | |
| requester.reference | author.assignedAuthor.id.extension | Filter practitioners using the C-CDA element and get the ID from the array |
createFHIRR4MedicationStatement
This module implements functions to support creation of FHIR R4 MedicationStatement.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4MedicationStatement.dwl
Functions
fun createMedicationStatement (medState, fhirMedStateConstants, medStateId, medReq, medDispense, patientId, medStateIdx)
Function to create MedicationStatement FHIR object from the input XML CDA Request.
param
medStateis an object from the CDA input XML, containing MedicationStatement information.
paramfhirMedStateConsantsis a set of constants used.
parammedStateIdis a reference to a MedicationDispense.
parammedReqis a list of medication requests.
parammedDispenseis a list of medication dispense.
parampatientIdis a reference to a Patient.
return A FHIR format MedicationStatement object.
| FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
|---|---|---|
| id | Id generated using GUID for resource | |
| text.status | Constant "generated" | |
| text.div | medState.text | Narrative that contains a summary of the resource in encoded format |
| identifier.system | medState.id | Identifier system for resource |
| identifier.value | medState.id | Identifier value for resource |
| basedOn | Function getMedReferenceId helps fetch reference for MedicationRequest | |
| partOf | Function getMedReferenceId helps fetch reference for MedicationDispense | |
| status | medState.statusCode.code | Conditionally mapped to "stopped" |
| medicationReference.reference | Medication reference | |
| subject.reference | patientId | Patient ID created from recordTarget |
| effectiveDateTime | medState.effectiveTime.low.value | Format datetime using formatDateTime function filtered for dataType IVL_TS |
| dosage.timing.repeat.frequency | medState.effectiveTime.period.value | Filter for frequency using dataType PIVL_TS |
| dosage.timing.repeat.period | Constant of "1" and can be modify as desired | |
| dosage.timing.repeat.periodUnit | medState.effectiveTime.period.unit | TimePeriod Unit |
| dosage.doseAndRate.code | medState.effectiveTime.institutionSpecified | Conditionally set to "calculated" |
| dosage.doseAndRate.system | Constant value | |
| dosage.doseQuantity.value | medState.doseQuantity.value | Medication quantity |
| dosage.doseQuantity.unit | medState.doseQuantity.unit | Medication quantity units |
| dosage.route.code | medState.routeCode.code | Dosage route code |
| dosage.route.system | medState.routeCode.codeSystem | Dosage route code system |
| dosage.route.display | medState.routeCode.dispalyName | Dosage route display |
createFHIRR4Observation
This module implements functions to support creation of FHIR R4 Observation.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4Observation.dwl
Functions
fun createObservation (observation, patientId, fhirObsrvConstants, obsrvId, practitionersList, cdaSectionName)
Function to create FHIR R4 Observation from CDA input XML request. Uses getIdentifier,createObservationValue,formatDateTime,ObservationStatusLookup,mapCodeSystem and mapCodeableConcept functions from cdaToFHIRTools.
param
observationis a resource of C-CDA Observation type.
parampatientIdis the ID of the Patient resource.
paramfhirObsrvConstantsis the list of constants used.
paramobsrvIdis the ID to be used for creating the resource.
return A FHIR format Observation resource.
| FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
|---|---|---|
| id | Id generated using GUID for resource | |
| text.status | Constant "generated" | |
| text.div | observation.text | Narrative that contains a summary of the resource in encoded format |
| identifier.system | observation.id | Identifier system for resource |
| identifier.value | observation.id | Identifier value for resource |
| category.system | Constant categorySystem from fhirConstants.Observation | |
| category.code | Constant categoryCode from fhirConstants.Observation | |
| status | observation.statusCode.code | Lookup code using function ObservationStatusLookup |
| code.code | resorce.code.code | Trim value for Observation code |
| code.display | resorce.code.displayName | Observation Code Name |
| code.system | resorce.code.codeSystem | Lookup codesystem using function mapCodeSystem |
| effectivePeriod.start | observation.effectiveTime.low.value | Format datetime using function formatDateTime |
| effectivePeriod.end | observation.effectiveTime.high.value | Format datetime using function formatDateTime |
| effectiveDateTime | observation.effectiveTime.value | Format datetime using function formatDateTime |
| value | Function createObservationValue maps either a CodeableConcept or an object | |
| range | Function createObservationRange maps reference ranges for observation | |
| interpretation.code | interpretationCode.code | Observation interpretation code |
| interpretation.system | interpretationCode.codeSystem | Lookup codeSystem using mapCodeableConcept |
| bodySite.code | observation.targetSiteCode.code | Body Site code |
| bodySite.system | Constant bodySiteSystem from fhirConstants.Observation | |
| subject.reference | patientId | Patient ID created from recordTarget |
fun createObservationValue (inValue)
Function to create value for US Core Observation using CDA C-CDA XML value.
param
inValueis the XML complex type for value in C-CDA.
return Either a valueCodeableConcept or value quantity type.
fun createObservationRange (inValue)
Function to create ObservationRange for US Core Observation using C-CDA XML value.
param
inValueis the XML complex type for value in C-CDA.
return a referenceRange element
fun ObservationStatusLookup (incode)
Function to convert C-CDA observation status to US Core Observation status.
param
incodeis the input observation status in C-CDA format.
return A FHIR format status code equivalent.
createFHIRR4Organization
This module implements functions to support creation of FHIR R4 Organization.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4Organization.dwl
Functions
fun createOrganization (org, fhirOrgConstants, orgId)
Function to create FHIR R4 Organization from CDA input XML request. Uses getIdentifier functions from cdaToFHIRTools.
param
orgis a resource of C-CDA Organization type.
paramfhirOrgConstantsis the list of constants used.
paramorgIdis the ID to be used for creating the resource.
return A FHIR format Observation resource.
| FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
|---|---|---|
| id | Id generated using GUID for resource | |
| text.status | Constant "generated" | |
| text.div | org.text | Narrative that contains a summary of the resource in encoded format |
| identifier.system | org.id | Identifier system for resource |
| identifier.value | org.id | Identifier value for resource |
| name | org.name | Org name |
| address.use | org.addr.use | Org Address Use |
| address.line | org.addr.streetAddressLine | Org Address Line |
| address.city | org.addr.city | Org Address City |
| address.state | org.addr.state | Org Address State |
| address.postalCode | org.addr.postalCode | Org Address Postal Code |
| address.country | org.addr.country | Org Address Country |
| address.period.start | org.addr.useablePeriod.low.value | Org Address used Start Date |
| address.period.end | org.addr.useablePeriod.high.value | Org Address used End Date |
| telecom.system | used telecomSystemLookup to lookup system value | |
| telecom.value | org.telecom.value | Org's communication details |
| telecom.use | org.telecom.use | Used telecomUseLookup function to lookup telecom use value |
| telecom.period.start | org.telecom.useablePeriod.low.value | Telecom system used start date |
| telecom.period.end | org.telecom.useablePeriod.high.value | Telecom system used end date |
createFHIRR4Patient
This module implements functions to support creation of FHIR R4 Patient.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4Patient.dwl
Functions
fun createPatient (patientRole, fhirPatientConstants, birthSex, patientId)
Function to create FHIR R4 Patient from CDA input XML request with parameters patientRole, fhirPatientConstants,birthSex.
param
patientRoleis an object from the CDA input XML under recordTarget, containing patient information.
paramfhirPatientConstantsis a list of constants used for creating patient resource.
parambirthSexis the assigned sex at birth of the patient. Generated from CCD's Social History template.
parampatientIdis the ID to be used for Patient resource.
return A FHIR formatted Patient object.
| FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
|---|---|---|
| id | Id generated using GUID for resource | |
| extension.valueCoding.system | Constant ombRaceCategorySystem from fhirConstants.Patient | |
| extension.valueCoding.code | patientRole.patient.raceCode.code | Patient's race code |
| extension.valueCoding.display | patientRole.patient.raceCode.displayName | Patient's race name |
| extension.url | Constant raceCategoryText from fhirConstants.Patient | |
| extension.valueString | patientRole.patient.raceCode.displayName | |
| url | Constant ombRaceUrl from fhirConstants.Patient | |
| identifier.type.system | Constant identifierSystem from fhirConstants.Patient | |
| identifier.type.code | Constant identifierCode from fhirConstants.Patient | |
| identifier.value | patientRole.id.extension | Patient Identifier |
| identifier.system | Constant identifierValueSystem from fhirConstants.Patient | |
| active | Constant "true" | |
| name.use | patientRole.patient.name.use | Used nameUseLookup function to lookup use value. |
| name.family | patientRole.patient.name.family | Patient's family name |
| name.given | patientRole.patient.name.given | Patient's given name |
| name.prefix | patientRole.patient.name.prefix | Patient's name prefix |
| name.suffix | patientRole.patient.name.suffix | Patient's name suffix |
| name.period.start | patientRole.patient.name.validTime.low.value | Patient's name used period start date |
| name.period.end | patientRole.patient.name.validTime.high.value | Patient's name used period end date |
| birthDate | patientRole.patient.birthTime.value | Format datetime using function formatDateTime |
| telecom.system | Used telecomSystemLookup to lookup system value | |
| telecom.value | patientRole.patient.telecom.phone.value | Patient's telecom details |
| telecom.use | patientRole.patient.telecom.phone.use | Used telecomUseLookup function to lookup telecom use value |
| telecom.period.start | patient.telecom.useablePeriod.low.value | Telecom system used period start date |
| telecom.period.end | patient.telecom.useablePeriod.high.value | Telecom system used period end date |
| gender | patientRole.patient.administrativeGenderCode.code | Lookup gender code using function genderLookup |
| address.use | patientRole.addr.use | Address use value |
| address.line | patientRole.addr.streetAddressLine | Patient's street address |
| address.city | patientRole.addr.city | Patient's Address city |
| address.state | patientRole.addr.state | Patient's Address state |
| address.postalCode | patientRole.addr.postalCode | Patient's Address postalCode |
| address.country | patientRole.addr.country | Patient's Address country |
| address.period.start | patientRole.addr.useablePeriod.low.value | Patient's Address used period start date |
| address.period.end | patientRole.addr.useablePeriod.high.value | Patient's Address used period end date |
| maritalStauts.coding.system | Constant maritalStatusSystem from fhirConstants.Patient | |
| maritalStauts.coding.code | patientRole.patient.maritalStatusCode.code | Patient's marital status code |
| maritalStauts.coding.display | patientRole.patient.maritalStatusCode.displayName | Patient's marital status display |
| contact.relationship.coding.system | Constant contactRelationshipSystem from fhirConstants.Patient | |
| contact.relationship.coding.code | patientRole.patient.guardian.code.code | Conditionally set to "C" or "N" |
| contact.relationship.coding.display | Conditionally set to "Emergency Contact" or "Next-of-Kin" | |
| contact.name.use | patientRole.patient.guardian.contact.guardianPerson.name.use | Used nameUseLookup function to lookup use value. |
| contact.name.family | patientRole.patient.guardian.guardianPerson.name.family | Patient's Guardian's family name |
| contact.name.given | patientRole.patient.guardian.guardianPerson.name.given | Patient's Guardian's given name |
| contact.name.prefix | patientRole.patient.guardian.guardianPerson.name.prefix | Patient's Guardian's name prefix |
| contact.name.suffix | patientRole.patient.guardian.guardianPerson.name.suffix | Patient's Guardian's name suffix |
| contact.name.period.start | patientRole.patient.guardian.guardianPerson.name.validTime.low.value | Patient's Guardian's name used period start date |
| contact.name.period.end | patientRole.patient.guardian.guardianPerson.name.validTime.high.value | Patient's Guardian's name used period end date |
| contact.telecom.system | Used telecomSystemLookup to lookup system value | |
| contact.telecom.value | patientRole.patient.guardian.telecom.phone.value | Patient's Guardian's telecom details |
| contact.telecom.use | patientRole.patient.guardian.telecom.phone.use | Used telecomUseLookup function to lookup telecom use value |
| contact.telecom.period.start | patientRole.patient.guardian.telecom.useablePeriod.low.value | Telecom system used period start date |
| contact.telecom.period.end | patientRole.patient.guardian.telecom.useablePeriod.high.value | Telecom system used period end date |
| contact.address.use | patientRole.patient.guardian.addr.use | Address use value |
| contact.address.line | patientRole.patient.guardian.addr.streetAddressLine | Patient's Guardian's street address |
| contact.address.city | patientRole.patient.guardian.addr.city | Patient's Guardian's Address city |
| contact.address.state | patientRole.patient.guardian.addr.state | Patient's Guardian's Address state |
| contact.address.postalCode | patientRole.patient.guardian.addr.postalCode | Patient's Guardian's Address postalCode |
| contact.address.country | patientRole.patient.guardian.addr.country | Patient's Guardian's Address country |
| contact.address.period.start | patientRole.patient.guardian.addr.useablePeriod.low.value | Patient's Guardian's Address used period start date |
| contact.address.period.end | patientRole.patient.guardian.addr.useablePeriod.high.value | Patient's Guardian's Address used period end date |
| communication.language.coding.system | Constant communicationLangaugeSystem from fhirConstants.Patient | |
| communication.language.coding.code | patientRole.patient.languageCommunication.languageCode.code | Patient's language of communication |
| communication.preferred | patientRole.patient.languageCommunication.preferenceInd.value | Conditionally true or false based on the C-CDA element |
fun mapPatientIdentifier (patientRole, fhirPatientConstants)
Maps the PatientIdentifier.
param
patientRoleis a String with the Patient Identifier information.
paramfhirPatientConstantsis a list of constants used for creating patient resource.
return A Patient Identifier object with the FHIR formatted structure.
createFHIRR4Practitioner
This module implements functions to support creation of FHIR R4 Practitioner.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4Practitioner.dwl
Functions
fun createPractitioner (pract, fhirPractConstants, practId)
Function to create FHIR R4 Practitioner from CDA input XML request. Uses getIdentifier functions from cdaToFHIRTools.
param
practis a resource of C-CDA Practitioner type.
paramfhirPractConstantsis the list of constants used.
parampractIdis the ID to be used for creating the resource.
return A FHIR format Practitioner resource.
| FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
|---|---|---|
| id | Id generated using GUID for resource | |
| identifier.system | pract.id | Identifier system for resource |
| identifier.value | pract.id | Identifier value for resource |
| name.use | pract.assignedPerson.name.use | Used nameUseLookup function to lookup use value. |
| name.family | pract.assignedPerson.name.family | Practitioner's family name |
| name.given | pract.assignedPerson.name.given | Practitioner's given name |
| name.prefix | pract.assignedPerson.name.prefix | Practitioner's name prefix |
| name.suffix | pract.assignedPerson.name.suffix | Practitioner's name suffix |
| name.period.start | pract.assignedPerson.name.validTime.low.value | Practitioner's name used period start date |
| name.period.end | pract.assignedPerson.name.validTime.high.value | Practitioner's name used period end date |
| address.use | pract.addr.use | Address use value |
| address.line | pract.addr.streetAddressLine | Practitioner's street address |
| address.city | pract.addr.city | Practitioner's Address city |
| address.state | pract.addr.state | Practitioner's Address state |
| address.postalCode | pract.addr.postalCode | Practitioner's Address postalCode |
| address.country | pract.addr.country | Practitioner's Address country |
| address.period.start | pract.addr.useablePeriod.low.value | Practitioner's Address used period start date |
| address.period.end | pract.addr.useablePeriod.high.value | Practitioner's Address used period end date |
| telecom.system | Used telecomSystemLookup to lookup system value | |
| telecom.value | pract.telecom.phone.value | Practitioner's telecom details |
| telecom.use | pract.telecom.phone.use | Used telecomUseLookup function to lookup telecom use value |
| telecom.period.start | pract.telecom.useablePeriod.low.value | Telecom system used period start date |
| telecom.period.end | pract.telecom.useablePeriod.high.value | Telecom system used period end date |
| qualification.code | pract.code.code | Practitioner's Qualification Code |
| qualification.display | pract.code.displayName | Practitioner's Qualification display name |
| qualification.system | Practitioner's Qualification System from fhirConstants's Practitioner |
fun buildPractitioners (practitioners, fhirPractConstants)
Function to create a list of FHIR R4 practitioners using input C-CDA's informants, author, legalAuthenticator. Uses createPractitioner from dwl.fhirUtil.
param
practitionersis the list of practitioners in C-CDA format.
paramfhirPractConstantsis a list of constants used for creating Practitioners.
return An array of FHIR R4 formated Practitioners.
fun buildPractitionersforRef (performers, practList, fhirPractConstants)
Function to build FHIR R4 Practitioners from Planned Procedures.
param
performersa list of authors for planned procedure.
parampractListis the list of informant practitioners from Header.
return An array of FHIR R4 Practitioners List.
fun buildPractRefList (perfList, practList)
Function to build a reference list of practitioners for Planned Procedure Service Request creation.
param
perfLista list of authors for planned procedure.
parampractListis the list of informant practitioners from Header.
return An array of id and identfiers of practitioners
fun getPractitionerRef (practList, authorId)
Function to fetch practitioner id from list.
param
practListis a list of practitioner's IDs and Identifiers.
paramauthorIdis the id to use for matching.
return A reference if a match is found else null.
createFHIRR4Procedure
This module implements functions to support creation of FHIR R4 Procedure.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4Procedure.dwl
Functions
fun getPerformerRefs (perfList, procRefType, refIdent)
Function to create performer reference.
param
perfListis the list of practitioners created.
paramprocRefTypeis a literal with either "Organization" or "Practitioner" for creating reference.
paramrefIdentis the identifier value to be used for lookup perfList's ID.
return A reference of type Organization or Practitioner.
fun createProcedure (proc, fhirProcConstants, patientId, procId, perfList, procType)
Function to create FHIR R4 Procedure from CDA input XML request. Uses formatDateTime,getIdentifier functions from cdaToFHIRTools.
param
procis the procedure component.
paramfhirProcPersonConstantsis the list of constants used to create related person FHIR resource.
parampatientIdis used as reference to patient in the related person resource.
paramprocIdis the ID to be used for creating the resource.
paramperfListis the list of practitioners.
paramprocTypeis a literal that identifies a Planned procedure vs a performed procedure.
return A FHIR format Procedure resource.
| FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
|---|---|---|
| id | Id generated using GUID for resource | |
| text.status | Constant "generated" | |
| text.div | proc.text | Narrative that contains a summary of the resource in encoded format |
| identifier.system | proc.id | Identifier system for resource |
| identifier.value | proc.id | Identifier value for resource |
| state | proc.statusCode.code | Conditionally set to "preparation" |
| code.code | proc.code.code | Procedure Code |
| code.display | proc.code.displayName | Procedure Name |
| code.system | Constant codeSystem from fhirConstants.Procedure | |
| performedDateTime | proc.effectiveTime.value | Format datetime using function formatDateTime |
| bodySite.code | proc.targetSiteCode.code | Procedure body site code |
| bodySite.display | proc.targetSiteCode.displayName | Procedure body site name |
| bodySite.system | Constant bodySiteSystem from fhirConstants.Procedure | |
| subject.reference | patientId | Patient Id created from recordTarget |
| performer.reference | proc.author.assignedAuthor.id or performer.assignedEntity.representedOrganization.id | Use function getPerformerRefs to fetch reference |
createFHIRR4RelatedPerson
This module implements Create RelatedPersons for C-CDA to FHIR conversion.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4RelatedPerson.dwl
Functions
fun createRelatedPerson (relatedPerson, fhirRelatedPersonConstants, patientId, relPerId)
Function to create FHIR R4 RelatedPerson from CDA input XML request. Uses relationshipLookup and addressUseLookup functions from cdaToFhirTools library.
param
relatedPersonis the relatedPerson component.
paramfhirRelatedPersonConstantsis the list of constants used to create related person FHIR resource.
parampatientIdis used as reference to patient in the related person resource.
paramrelPerIdis the ID to be used for creating the resource .
return An array of FHIR formatted relatedPerson array.
| FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
|---|---|---|
| id | Id generated using GUID for resource | |
| identifier.system | relatedPerson.id | Identifier system for resource |
| identifier.value | relatedPerson.id | Identifier value for resource |
| patient.reference | patientId | Patient Id created from recordTarget |
| relationship.system | Constant relationshipSystem from fhirConstants.RelatedPerson | |
| relationship.code | relatedPerson.associatedEntity.classCode | Lookup using function relationshipLookup |
| active | Constant value "true" | |
| name.use | relatedPerson.associatedEntity.associatedPerson.name.use | Used nameUseLookup function to lookup use value. |
| name.family | relatedPerson.associatedEntity.associatedPerson.name.family | RelatedPerson's family name |
| name.given | relatedPerson.associatedEntity.associatedPerson.name.given | RelatedPerson's given name |
| name.prefix | relatedPerson.associatedEntity.associatedPerson.name.prefix | RelatedPerson's name prefix |
| name.suffix | relatedPerson.associatedEntity.associatedPerson.name.suffix | RelatedPerson's name suffix |
| name.period.start | relatedPerson.associatedEntity.associatedPerson.name.validTime.low.value | RelatedPerson's name used period start date |
| name.period.end | relatedPerson.associatedEntity.associatedPerson.name.validTime.high.value | RelatedPerson's name used period end date |
| telecom.system | Used telecomSystemLookup to lookup system value | |
| telecom.value | relatedPerson.associatedEntity.telecom.phone.value | RelatedPerson's telecom details |
| telecom.use | relatedPerson.associatedEntity.telecom.phone.use | Used telecomUseLookup function to lookup telecom use value |
| telecom.period.start | relatedPerson.associatedEntity.telecom.useablePeriod.low.value | Telecom system used period start date |
| telecom.period.end | relatedPerson.associatedEntity.telecom.useablePeriod.high.value | Telecom system used period end date |
| address.use | relatedPerson.associatedEntity.addr.use | Address use value |
| address.line | relatedPerson.associatedEntity.addr.streetAddressLine | RelatedPerson's street address |
| address.city | relatedPerson.associatedEntity.addr.city | RelatedPerson's Address city |
| address.state | relatedPerson.associatedEntity.addr.state | RelatedPerson's Address state |
| address.postalCode | relatedPerson.associatedEntity.addr.postalCode | RelatedPerson's Address postalCode |
| address.country | relatedPerson.associatedEntity.addr.country | RelatedPerson's Address country |
| address.period.start | relatedPerson.associatedEntity.addr.useablePeriod.low.value | RelatedPerson's Address used period start date |
| address.period.end | relatedPerson.associatedEntity.addr.useablePeriod.high.value | RelatedPerson's Address used period end date |
createFHIRR4ServiceRequest
This module implements functions to support creation of FHIR R4 ServiceRequest.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4ServiceRequest.dwl
Functions
fun createServiceRequest (servReq, servReqId, patientId, fhirServReqConstants, practList)
Function to create ServiceRequest FHIR object from incoming C-CDA Request. Uses getIdentifier,formatDateTime,servReqStatusLookup,mapCodeSystem function from cdaToFHIRTools and getPractitionerRef.
param
servReqis an object from the CDA input XML, containing ServiceRequest information.
paramfhirServReqConstantsis a list of constants to be used for mapping.
paramservReqIdis the ID for the resource.
parampatientIdis the patient ID.
return A FHIR formatted ServiceRequest object.
| FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
|---|---|---|
| id | Id generated using GUID for resource | |
| text.status | Constant "generated" | |
| text.div | servReq.text | Narrative that contains a summary of the resource in encoded format |
| identifier.system | servReq.id | Identifier system for resource |
| identifier.value | servReq.id | Identifier value for resource |
| status | servReq.statusCode.code | Lookup statusCode using function servReqStatusLookup |
| occurrenceDateTime | servReq.effectiveTime.value | Format datetime using function formatDateTime |
| intent | Constant value "proposal" and can update as needed | |
| code.system | servReq.code.codeSystem | Convert codeSystem using function mapCodeSystem |
| code.code | servReq.code.code | Service Request Code |
| code.display | servReq.code.displayName | Display Name for Service Request code |
| subject.reference | patientId | PatientId from recordTarget |
| authoredOn | servReq.author.time.value | Format datetime using function formatDateTime |
| author.reference | servReq.author.assignedAuthor.id.extension | Use function getPractitionerRef for lookup |